This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 225530
Collapse All | Expand All

(-)a/java.lexer/apichanges.xml (+161 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!-- Search for CHANGEME in this document when copying and using it: -->
3
<!--
4
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5
6
Copyright 2013 Oracle and/or its affiliates. All rights reserved.
7
8
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
9
Other names may be trademarks of their respective owners.
10
11
12
The contents of this file are subject to the terms of either the GNU
13
General Public License Version 2 only ("GPL") or the Common
14
Development and Distribution License("CDDL") (collectively, the
15
"License"). You may not use this file except in compliance with the
16
License. You can obtain a copy of the License at
17
http://www.netbeans.org/cddl-gplv2.html
18
or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
19
specific language governing permissions and limitations under the
20
License.  When distributing the software, include this License Header
21
Notice in each file and include the License file at
22
nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
23
particular file as subject to the "Classpath" exception as provided
24
by Oracle in the GPL Version 2 section of the License file that
25
accompanied this code. If applicable, add the following below the
26
License Header, with the fields enclosed by brackets [] replaced by
27
your own identifying information:
28
"Portions Copyrighted [year] [name of copyright owner]"
29
30
Contributor(s):
31
32
The Original Software is NetBeans. The Initial Developer of the Original
33
Software is Sun Microsystems, Inc. Portions Copyright 2013 Sun
34
Microsystems, Inc. All Rights Reserved.
35
36
If you wish your version of this file to be governed by only the CDDL
37
or only the GPL Version 2, indicate your decision by adding
38
"[Contributor] elects to include this software in this distribution
39
under the [CDDL or GPL Version 2] license." If you do not indicate a
40
single choice of license, a recipient has the option to distribute
41
your version of this file under either the CDDL, the GPL Version 2 or
42
to extend the choice of license to its licensees as provided above.
43
However, if you add GPL Version 2 code and therefore, elected the GPL
44
Version 2 license, then the option applies only if the new code is
45
made subject to such option by the copyright holder.
46
-->
47
<?xml-stylesheet type="text/xml" href="../nbbuild/javadoctools/apichanges.xsl"?>
48
<!DOCTYPE apichanges PUBLIC "-//NetBeans//DTD API changes list 1.0//EN" "../nbbuild/javadoctools/apichanges.dtd">
49
50
<!--
51
52
INFO FOR PEOPLE ADDING CHANGES:
53
54
Check the DTD (apichanges.dtd) for details on the syntax. You do not
55
need to regenerate the HTML, as this is part of Javadoc generation; just
56
change the XML. Rough syntax of a change (several parts optional):
57
58
<change>
59
    <api name="compiler"/>
60
    <summary>Some brief description here, can use <b>XHTML</b></summary>
61
    <version major="1" minor="99"/>
62
    <date day="13" month="6" year="2001"/>
63
    <author login="jrhacker"/>
64
    <compatibility addition="yes"/>
65
    <description>
66
        The main description of the change here.
67
        Again can use full <b>XHTML</b> as needed.
68
    </description>
69
    <class package="org.openide.compiler" name="DoWhatIWantCompiler"/>
70
    <issue number="14309"/>
71
</change>
72
73
Also permitted elements: <package>, <branch>. <version> is API spec
74
version, recommended for all new changes. <compatibility> should say
75
if things were added/modified/deprecated/etc. and give all information
76
related to upgrading old code. List affected top-level classes and
77
link to issue numbers if applicable. See the DTD for more details.
78
79
Changes need not be in any particular order, they are sorted in various
80
ways by the stylesheet anyway.
81
82
Dates are assumed to mean "on the trunk". If you *also* make the same
83
change on a stabilization branch, use the <branch> tag to indicate this
84
and explain why the change was made on a branch in the <description>.
85
86
Please only change this file on the trunk! Rather: you can change it
87
on branches if you want, but these changes will be ignored; only the
88
trunk version of this file is important.
89
90
Deprecations do not count as incompatible, assuming that code using the
91
deprecated calls continues to see their documented behavior. But do
92
specify deprecation="yes" in <compatibility>.
93
94
This file is not a replacement for Javadoc: it is intended to list changes,
95
not describe the complete current behavior, for which ordinary documentation
96
is the proper place.
97
98
-->
99
100
<apichanges>
101
102
    <!-- First, a list of API names you may use: -->
103
    <apidefs>
104
        <apidef name="general">Java Lexer API</apidef>
105
        <!-- etc. -->
106
    </apidefs>
107
108
    <!-- ACTUAL CHANGES BEGIN HERE: -->
109
110
    <changes>
111
         <change id="Lambda-Tokens">
112
             <api name="general"/>
113
             <summary>Double colon and arrow token ids added</summary>
114
             <version major="1" minor="23"/>
115
             <date day="13" month="2" year="2013"/>
116
             <author login="jlahoda"/>
117
            <compatibility addition="yes" binary="compatible" deletion="no" deprecation="no" modification="no" semantic="compatible" source="compatible"/>
118
             <description>
119
                 Added JavaTokenId.COLONCOLON and JavaTokenId.ARROW.
120
             </description>
121
             <class package="org.netbeans.api.java.lexer" name="JavaTokenId"/>
122
             <issue number="225530"/>
123
        </change>
124
    </changes>
125
126
    <!-- Now the surrounding HTML text and document structure: -->
127
128
    <htmlcontents>
129
<!--
130
131
                            NO NO NO NO NO!
132
133
         ==============>    DO NOT EDIT ME!  <==============
134
135
          AUTOMATICALLY GENERATED FROM APICHANGES.XML, DO NOT EDIT
136
137
                SEE CHANGEME/apichanges.xml
138
139
-->
140
    <head>
141
      <title>Change History for the Java Lexer API</title>
142
      <link rel="stylesheet" href="prose.css" type="text/css"/>
143
    </head>
144
    <body>
145
146
<p class="overviewlink"><a href="overview-summary.html">Overview</a></p>
147
148
<h1>Introduction</h1>
149
150
<p>This document lists changes made to the <!--<a href="@org-netbeans-modules-java-lexer@/architecture-summary.html">-->Java Lexer API<!--</a>-->.</p>
151
152
<!-- The actual lists of changes, as summaries and details: -->
153
      <hr/>
154
      <standard-changelists module-code-name="org.netbeans.modules.java.lexer"/>
155
156
      <hr/><p>@FOOTER@</p>
157
158
    </body>
159
  </htmlcontents>
160
161
</apichanges>
(-)a/java.lexer/manifest.mf (-1 / +1 lines)
Lines 1-5 Link Here
1
OpenIDE-Module: org.netbeans.modules.java.lexer/1
1
OpenIDE-Module: org.netbeans.modules.java.lexer/1
2
OpenIDE-Module-Localizing-Bundle: org/netbeans/lib/java/lexer/Bundle.properties
2
OpenIDE-Module-Localizing-Bundle: org/netbeans/lib/java/lexer/Bundle.properties
3
OpenIDE-Module-Specification-Version: 1.22
3
OpenIDE-Module-Specification-Version: 1.23
4
OpenIDE-Module-Layer: org/netbeans/lib/java/lexer/layer.xml
4
OpenIDE-Module-Layer: org/netbeans/lib/java/lexer/layer.xml
5
5
(-)a/java.lexer/nbproject/project.properties (+1 lines)
Lines 44-49 Link Here
44
javac.compilerargs=-Xlint:unchecked
44
javac.compilerargs=-Xlint:unchecked
45
javac.source=1.6
45
javac.source=1.6
46
javadoc.title=Java Lexer API
46
javadoc.title=Java Lexer API
47
javadoc.apichanges=${basedir}/apichanges.xml
47
48
48
test.config.stableBTD.includes=**/*Test.class
49
test.config.stableBTD.includes=**/*Test.class
49
test.config.stableBTD.excludes=\
50
test.config.stableBTD.excludes=\
(-)a/java.lexer/src/org/netbeans/api/java/lexer/JavaTokenId.java (+4 lines)
Lines 142-147 Link Here
142
    SEMICOLON(";", "separator"),
142
    SEMICOLON(";", "separator"),
143
    COMMA(",", "separator"),
143
    COMMA(",", "separator"),
144
    DOT(".", "separator"),
144
    DOT(".", "separator"),
145
    /**@since 1.23*/
146
    COLONCOLON("::", "separator"),
147
    /**@since 1.23*/
148
    ARROW("->", "separator"),
145
149
146
    EQ("=", "operator"),
150
    EQ("=", "operator"),
147
    GT(">", "operator"),
151
    GT(">", "operator"),
(-)a/java.lexer/src/org/netbeans/lib/java/lexer/JavaLexer.java (-5 / +7 lines)
Lines 83-89 Link Here
83
        assert (info.state() == null); // never set to non-null value in state()
83
        assert (info.state() == null); // never set to non-null value in state()
84
        
84
        
85
        Integer ver = (Integer)info.getAttributeValue("version");
85
        Integer ver = (Integer)info.getAttributeValue("version");
86
        this.version = (ver != null) ? ver.intValue() : 7; // TODO: Java 1.7 used by default
86
        this.version = (ver != null) ? ver.intValue() : 8; // TODO: Java 1.8 used by default
87
    }
87
    }
88
    
88
    
89
    public Object state() {
89
    public Object state() {
Lines 97-106 Link Here
97
            switch (c) {
97
            switch (c) {
98
                case '#':
98
                case '#':
99
                    //Support for exotic identifiers has been removed 6999438
99
                    //Support for exotic identifiers has been removed 6999438
100
                    if (true || this.version < 7 || input.read() != '"') {
100
                    return token(JavaTokenId.ERROR);
101
                        return token(JavaTokenId.ERROR);
102
                    }
103
                    lookupId = JavaTokenId.IDENTIFIER;
104
                case '"': // string literal
101
                case '"': // string literal
105
                    if (lookupId == null) lookupId = JavaTokenId.STRING_LITERAL;
102
                    if (lookupId == null) lookupId = JavaTokenId.STRING_LITERAL;
106
                    while (true)
103
                    while (true)
Lines 240-245 Link Here
240
                            return token(JavaTokenId.MINUSMINUS);
237
                            return token(JavaTokenId.MINUSMINUS);
241
                        case '=':
238
                        case '=':
242
                            return token(JavaTokenId.MINUSEQ);
239
                            return token(JavaTokenId.MINUSEQ);
240
                        case '>':
241
                            return token(JavaTokenId.ARROW);
243
                    }
242
                    }
244
                    input.backup(1);
243
                    input.backup(1);
245
                    return token(JavaTokenId.MINUS);
244
                    return token(JavaTokenId.MINUS);
Lines 311-316 Link Here
311
                case ';':
310
                case ';':
312
                    return token(JavaTokenId.SEMICOLON);
311
                    return token(JavaTokenId.SEMICOLON);
313
                case ':':
312
                case ':':
313
                    if (input.read() == ':')
314
                        return token(JavaTokenId.COLONCOLON);
315
                    input.backup(1);
314
                    return token(JavaTokenId.COLON);
316
                    return token(JavaTokenId.COLON);
315
                case '?':
317
                case '?':
316
                    return token(JavaTokenId.QUESTION);
318
                    return token(JavaTokenId.QUESTION);
(-)a/java.lexer/test/unit/src/org/netbeans/lib/java/lexer/JavaLexerBatchTest.java (+22 lines)
Lines 449-454 Link Here
449
        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.STRING_LITERAL, "\" \"");
449
        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.STRING_LITERAL, "\" \"");
450
    }
450
    }
451
451
452
    public void testInterferenceBraceIdent() {
453
        String text = "() -> {A::a();}";
454
        InputAttributes attr = new InputAttributes();
455
        attr.setValue(JavaTokenId.language(), "version", Integer.valueOf(7), true);
456
        TokenHierarchy<?> hi = TokenHierarchy.create(text, false, JavaTokenId.language(), EnumSet.of(JavaTokenId.WHITESPACE), attr);
457
        TokenSequence<?> ts = hi.tokenSequence();
458
459
        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.LPAREN, "(");
460
        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.RPAREN, ")");
461
        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.ARROW, "->");
462
        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.LBRACE, "{");
463
        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.IDENTIFIER, "A");
464
        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.COLONCOLON, "::");
465
        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.IDENTIFIER, "a");
466
        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.LPAREN, "(");
467
        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.RPAREN, ")");
468
        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.SEMICOLON, ";");
469
        LexerTestUtilities.assertNextTokenEquals(ts, JavaTokenId.RBRACE, "}");
470
471
        assertFalse(ts.moveNext());
472
    }
473
452
    public void testBinaryLiterals() {
474
    public void testBinaryLiterals() {
453
        String text = "0b101 0B101 0b101l 0b101L";
475
        String text = "0b101 0B101 0b101l 0b101L";
454
        InputAttributes attr = new InputAttributes();
476
        InputAttributes attr = new InputAttributes();

Return to bug 225530