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 267830
Collapse All | Expand All

(-)a/java.hints.legacy.spi/nbproject/project.properties (-1 / +1 lines)
Lines 38-43 Link Here
38
is.autoload=true
38
is.autoload=true
39
javac.source=1.7
39
javac.source=1.7
40
javac.compilerargs=-Xlint -Xlint:-serial
40
javac.compilerargs=-Xlint -Xlint:-serial
41
spec.version.base=1.15.0
41
spec.version.base=1.16.0
42
javadoc.arch=${basedir}/arch.xml
42
javadoc.arch=${basedir}/arch.xml
43
requires.nb.javac=true
43
requires.nb.javac=true
(-)a/java.hints.legacy.spi/nbproject/project.xml (-9 / +2 lines)
Lines 143-159 Link Here
143
                    </run-dependency>
143
                    </run-dependency>
144
                </dependency>
144
                </dependency>
145
            </module-dependencies>
145
            </module-dependencies>
146
            <friend-packages>
146
            <public-packages>
147
                <friend>org.netbeans.modules.apisupport.ant</friend>
148
                <friend>org.netbeans.modules.javadoc</friend>
149
                <friend>org.netbeans.modules.javahints</friend>
150
                <friend>org.netbeans.modules.maven.hints</friend>
151
                <friend>org.netbeans.modules.maven.j2ee</friend>
152
                <friend>org.netbeans.modules.web.beans</friend>
153
                <package>org.netbeans.modules.java.hints.spi</package>
147
                <package>org.netbeans.modules.java.hints.spi</package>
154
                <package>org.netbeans.modules.java.hints.spi.support</package>
148
                <package>org.netbeans.modules.java.hints.spi.support</package>
155
                <package>org.netbeans.modules.jshell.support</package>
149
            </public-packages>
156
            </friend-packages>
157
        </data>
150
        </data>
158
    </configuration>
151
    </configuration>
159
</project>
152
</project>
(-)a/java.hints.legacy.spi/src/org/netbeans/modules/java/hints/legacy/spi/Bundle.properties (-1 / +1 lines)
Lines 35-39 Link Here
35
# made subject to such option by the copyright holder.
35
# made subject to such option by the copyright holder.
36
#
36
#
37
# Contributor(s):
37
# Contributor(s):
38
OpenIDE-Module-Name=Legacy Java Hints SPI
38
OpenIDE-Module-Name=Java Hints SPI
39
OpenIDE-Module-Deprecation-Message=Use Java Hints SPI (org.netbeans.spi.java.hints) instead.
39
OpenIDE-Module-Deprecation-Message=Use Java Hints SPI (org.netbeans.spi.java.hints) instead.
(-)edfb33e6d35d (+71 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2013 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.java.hints.spi;
43
44
import com.sun.source.util.TreePath;
45
import javax.tools.Diagnostic;
46
import org.netbeans.api.java.source.CompilationInfo;
47
48
/**
49
 * The interface is an optional mixing which can be present on the ErrorRule implementation and takes care of potential
50
 * transformation of the standard message to something more precise. If present, it will be called as part of error
51
 * conversion to annotations to produce a different error message. If more rules matching diagnostic key respond
52
 * to the createMessage call, the infrastructure will choose a message or several messages to appear. All fixes will be available from that
53
 * message.
54
 * <p/>
55
 * Note that the customized message does not propagate into the task list; the task list will show the original javac message.
56
 * @since 1.16
57
 */
58
public interface OverrideErrorMessage<T> extends ErrorRule<T> {
59
    /**
60
     * Provides a custom error message to replace the one in Diagnostic. If the implementation does not want to produce
61
     * a custom message, it should return {@code null}, the default message will be used. If the Rule stores a data 
62
     * into the 'data' holder, that data will be available later, in the call to run() method. 
63
     * 
64
     * @param info context
65
     * @param diagnosticKey error message key
66
     * @param offset offset in the Source
67
     * @param treePath path to the error, if available
68
     * @return an override message to be displayed instead of the standard one or {@code null} to use the standard one.
69
     */
70
    public String createMessage(CompilationInfo info, Diagnostic diagnosticKey, int offset, TreePath treePath, Data<T> data);
71
}
(-)a/java.hints/src/org/netbeans/modules/java/hints/errors/OverrideErrorMessage.java (-2 / +1 lines)
Lines 44-50 Link Here
44
import com.sun.source.util.TreePath;
44
import com.sun.source.util.TreePath;
45
import javax.tools.Diagnostic;
45
import javax.tools.Diagnostic;
46
import org.netbeans.api.java.source.CompilationInfo;
46
import org.netbeans.api.java.source.CompilationInfo;
47
import org.netbeans.modules.java.hints.spi.ErrorRule;
48
47
49
/**
48
/**
50
 * The interface is an optional mixing which can be present on the ErrorRule implementation and takes care of potential
49
 * The interface is an optional mixing which can be present on the ErrorRule implementation and takes care of potential
Lines 55-61 Link Here
55
 * <p/>
54
 * <p/>
56
 * Note that the customized message does not propagate into the task list; the task list will show the original javac message.
55
 * Note that the customized message does not propagate into the task list; the task list will show the original javac message.
57
 */
56
 */
58
public interface OverrideErrorMessage<T> extends ErrorRule<T> {
57
public interface OverrideErrorMessage<T> extends org.netbeans.modules.java.hints.spi.OverrideErrorMessage<T> {
59
    /**
58
    /**
60
     * Provides a custom error message to replace the one in Diagnostic. If the implementation does not want to produce
59
     * Provides a custom error message to replace the one in Diagnostic. If the implementation does not want to produce
61
     * a custom message, it should return {@code null}, the default message will be used. If the Rule stores a data 
60
     * a custom message, it should return {@code null}, the default message will be used. If the Rule stores a data 
(-)a/java.hints/src/org/netbeans/modules/java/hints/infrastructure/ErrorHintsProvider.java (-1 / +1 lines)
Lines 82-93 Link Here
82
import org.netbeans.lib.editor.util.swing.DocumentUtilities;
82
import org.netbeans.lib.editor.util.swing.DocumentUtilities;
83
import org.netbeans.modules.editor.NbEditorDocument;
83
import org.netbeans.modules.editor.NbEditorDocument;
84
import org.netbeans.modules.editor.java.Utilities;
84
import org.netbeans.modules.editor.java.Utilities;
85
import org.netbeans.modules.java.hints.errors.OverrideErrorMessage;
86
import org.netbeans.modules.java.hints.jdk.ConvertToDiamondBulkHint;
85
import org.netbeans.modules.java.hints.jdk.ConvertToDiamondBulkHint;
87
import org.netbeans.modules.java.hints.jdk.ConvertToLambda;
86
import org.netbeans.modules.java.hints.jdk.ConvertToLambda;
88
import org.netbeans.modules.java.hints.legacy.spi.RulesManager;
87
import org.netbeans.modules.java.hints.legacy.spi.RulesManager;
89
import org.netbeans.modules.java.hints.spi.ErrorRule;
88
import org.netbeans.modules.java.hints.spi.ErrorRule;
90
import org.netbeans.modules.java.hints.spi.ErrorRule.Data;
89
import org.netbeans.modules.java.hints.spi.ErrorRule.Data;
90
import org.netbeans.modules.java.hints.spi.OverrideErrorMessage;
91
import org.netbeans.modules.java.source.parsing.Hacks;
91
import org.netbeans.modules.java.source.parsing.Hacks;
92
import org.netbeans.modules.parsing.spi.Parser.Result;
92
import org.netbeans.modules.parsing.spi.Parser.Result;
93
import org.netbeans.modules.parsing.spi.Scheduler;
93
import org.netbeans.modules.parsing.spi.Scheduler;
(-)a/jshell.support/manifest.mf (+1 lines)
Lines 3-5 Link Here
3
OpenIDE-Module: org.netbeans.modules.jshell.support
3
OpenIDE-Module: org.netbeans.modules.jshell.support
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jshell/support/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/jshell/support/Bundle.properties
5
OpenIDE-Module-Layer: org/netbeans/modules/jshell/resources/layer.xml
5
OpenIDE-Module-Layer: org/netbeans/modules/jshell/resources/layer.xml
6
OpenIDE-Module-Specification-Version: 1.1
(-)a/jshell.support/nbproject/project.properties (-1 lines)
Lines 1-5 Link Here
1
javac.source=1.8
1
javac.source=1.8
2
javac.compilerargs=-Xlint -Xlint:-serial
2
javac.compilerargs=-Xlint -Xlint:-serial
3
spec.version.base=1.0
4
cp.extra=${tools.jar}
3
cp.extra=${tools.jar}
5
bootclasspath.prepend=${nb_all}/libs.javacapi/external/nb-javac-api.jar${path.separator}${nb_all}/libs.javacimpl/external/nb-javac-impl.jar
4
bootclasspath.prepend=${nb_all}/libs.javacapi/external/nb-javac-api.jar${path.separator}${nb_all}/libs.javacimpl/external/nb-javac-impl.jar
(-)a/jshell.support/nbproject/project.xml (-12 / +1 lines)
Lines 185-191 Link Here
185
                    <compile-dependency/>
185
                    <compile-dependency/>
186
                    <run-dependency>
186
                    <run-dependency>
187
                        <release-version>1</release-version>
187
                        <release-version>1</release-version>
188
                        <implementation-version/>
189
                    </run-dependency>
188
                    </run-dependency>
190
                </dependency>
189
                </dependency>
191
                <dependency>
190
                <dependency>
Lines 234-254 Link Here
234
                    </run-dependency>
233
                    </run-dependency>
235
                </dependency>
234
                </dependency>
236
                <dependency>
235
                <dependency>
237
                    <code-name-base>org.netbeans.modules.java.hints</code-name-base>
238
                    <build-prerequisite/>
239
                    <compile-dependency/>
240
                    <run-dependency>
241
                        <release-version>1</release-version>
242
                        <implementation-version/>
243
                    </run-dependency>
244
                </dependency>
245
                <dependency>
246
                    <code-name-base>org.netbeans.modules.java.hints.legacy.spi</code-name-base>
236
                    <code-name-base>org.netbeans.modules.java.hints.legacy.spi</code-name-base>
247
                    <build-prerequisite/>
237
                    <build-prerequisite/>
248
                    <compile-dependency/>
238
                    <compile-dependency/>
249
                    <run-dependency>
239
                    <run-dependency>
250
                        <release-version>1</release-version>
240
                        <release-version>1</release-version>
251
                        <implementation-version/>
241
                        <specification-version>1.16</specification-version>
252
                    </run-dependency>
242
                    </run-dependency>
253
                </dependency>
243
                </dependency>
254
                <dependency>
244
                <dependency>
Lines 318-324 Link Here
318
                    <build-prerequisite/>
308
                    <build-prerequisite/>
319
                    <compile-dependency/>
309
                    <compile-dependency/>
320
                    <run-dependency>
310
                    <run-dependency>
321
                        <implementation-version/>
322
                    </run-dependency>
311
                    </run-dependency>
323
                </dependency>
312
                </dependency>
324
                <dependency>
313
                <dependency>
(-)a/jshell.support/src/org/netbeans/modules/jshell/editor/SnippetClassGenerator.java (-2 / +1 lines)
Lines 63-69 Link Here
63
import org.netbeans.api.project.Project;
63
import org.netbeans.api.project.Project;
64
import org.netbeans.api.templates.FileBuilder;
64
import org.netbeans.api.templates.FileBuilder;
65
import org.netbeans.modules.editor.indent.api.Reformat;
65
import org.netbeans.modules.editor.indent.api.Reformat;
66
import org.netbeans.modules.java.hints.OrganizeImports;
67
import org.netbeans.modules.jshell.support.ShellSession;
66
import org.netbeans.modules.jshell.support.ShellSession;
68
import org.openide.cookies.EditorCookie;
67
import org.openide.cookies.EditorCookie;
69
import org.openide.filesystems.FileObject;
68
import org.openide.filesystems.FileObject;
Lines 302-308 Link Here
302
            src.runModificationTask(wc ->  {
301
            src.runModificationTask(wc ->  {
303
                wc.toPhase(JavaSource.Phase.RESOLVED);
302
                wc.toPhase(JavaSource.Phase.RESOLVED);
304
               this.copy = wc;
303
               this.copy = wc;
305
               OrganizeImports.doOrganizeImports(copy, null, true);
304
//               OrganizeImports.doOrganizeImports(copy, null, true);
306
            }).commit();
305
            }).commit();
307
            editor.saveDocument();
306
            editor.saveDocument();
308
        } catch (IOException ex) {
307
        } catch (IOException ex) {
(-)a/jshell.support/src/org/netbeans/modules/jshell/project/JShellOptions2.java (-3 / +3 lines)
Lines 82-88 Link Here
82
import org.netbeans.api.project.SourceGroup;
82
import org.netbeans.api.project.SourceGroup;
83
import org.netbeans.modules.java.j2seproject.api.J2SECategoryExtensionProvider;
83
import org.netbeans.modules.java.j2seproject.api.J2SECategoryExtensionProvider;
84
import org.netbeans.modules.java.j2seproject.api.J2SECategoryExtensionProvider.ConfigChangeListener;
84
import org.netbeans.modules.java.j2seproject.api.J2SECategoryExtensionProvider.ConfigChangeListener;
85
import org.netbeans.modules.java.source.parsing.ClasspathInfoProvider;
85
//import org.netbeans.modules.java.source.parsing.ClasspathInfoProvider;
86
import org.netbeans.modules.jshell.project.RunOptionsModel.LoaderPolicy;
86
import org.netbeans.modules.jshell.project.RunOptionsModel.LoaderPolicy;
87
import org.netbeans.modules.parsing.api.ParserManager;
87
import org.netbeans.modules.parsing.api.ParserManager;
88
import org.netbeans.modules.parsing.api.ResultIterator;
88
import org.netbeans.modules.parsing.api.ResultIterator;
Lines 176-184 Link Here
176
            return;
176
            return;
177
        }
177
        }
178
        
178
        
179
        class UT extends UserTask implements ClasspathInfoProvider {
179
        class UT extends UserTask /*implements ClasspathInfoProvider*/ {
180
180
181
            @Override
181
//            @Override
182
            public ClasspathInfo getClasspathInfo() {
182
            public ClasspathInfo getClasspathInfo() {
183
                return JShellOptions2.this.getClasspathInfo();
183
                return JShellOptions2.this.getClasspathInfo();
184
            }
184
            }
(-)a/jshell.support/src/org/netbeans/modules/jshell/support/LocationSuppressRule.java (-2 / +1 lines)
Lines 50-61 Link Here
50
import java.util.regex.Pattern;
50
import java.util.regex.Pattern;
51
import javax.tools.Diagnostic;
51
import javax.tools.Diagnostic;
52
import org.netbeans.api.java.source.CompilationInfo;
52
import org.netbeans.api.java.source.CompilationInfo;
53
import org.netbeans.modules.java.hints.errors.OverrideErrorMessage;
54
import org.netbeans.modules.java.hints.spi.ErrorRule;
53
import org.netbeans.modules.java.hints.spi.ErrorRule;
54
import org.netbeans.modules.java.hints.spi.OverrideErrorMessage;
55
import org.netbeans.spi.editor.hints.Fix;
55
import org.netbeans.spi.editor.hints.Fix;
56
import org.openide.util.NbBundle;
56
import org.openide.util.NbBundle;
57
57
58
import static org.netbeans.modules.jshell.support.Bundle.*;
59
/**
58
/**
60
 * Suppresses erroneous locations. The javac gives location in its error messages, which
59
 * Suppresses erroneous locations. The javac gives location in its error messages, which
61
 * displays classname. In case of JShell snippets, those class names are 'hidden' and computer generated
60
 * displays classname. In case of JShell snippets, those class names are 'hidden' and computer generated
(-)a/jshell.support/src/org/netbeans/modules/jshell/support/SemicolonMissingRule.java (-8 / +6 lines)
Lines 42-48 Link Here
42
package org.netbeans.modules.jshell.support;
42
package org.netbeans.modules.jshell.support;
43
43
44
import com.sun.source.util.TreePath;
44
import com.sun.source.util.TreePath;
45
import com.sun.tools.javac.parser.Tokens;
46
import java.util.Arrays;
45
import java.util.Arrays;
47
import java.util.HashSet;
46
import java.util.HashSet;
48
import java.util.List;
47
import java.util.List;
Lines 51-59 Link Here
51
import javax.swing.text.Document;
50
import javax.swing.text.Document;
52
import javax.tools.Diagnostic;
51
import javax.tools.Diagnostic;
53
import org.netbeans.api.java.source.CompilationInfo;
52
import org.netbeans.api.java.source.CompilationInfo;
54
import org.netbeans.modules.java.hints.errors.OverrideErrorMessage;
53
import org.netbeans.modules.java.hints.spi.OverrideErrorMessage;
55
import org.netbeans.modules.java.source.parsing.Hacks;
54
//import org.netbeans.modules.java.source.parsing.Hacks;
56
import org.openide.util.Exceptions;
57
55
58
/**
56
/**
59
 * Suppresses error warning that a semicolon is missing from the input. JShell automatically
57
 * Suppresses error warning that a semicolon is missing from the input. JShell automatically
Lines 66-75 Link Here
66
    
64
    
67
    @Override
65
    @Override
68
    public String createMessage(CompilationInfo info, Diagnostic d, int offset, TreePath treePath, Data data) {
66
    public String createMessage(CompilationInfo info, Diagnostic d, int offset, TreePath treePath, Data data) {
69
        Object dp = Hacks.getDiagnosticParam(d, 0);
67
//        Object dp = Hacks.getDiagnosticParam(d, 0);
70
        if (dp != Tokens.TokenKind.SEMI) {
68
//        if (dp != Tokens.TokenKind.SEMI) {
71
            return null;
69
//            return null;
72
        }
70
//        }
73
        
71
        
74
        int off = offset;
72
        int off = offset;
75
        final CharSequence seq = info.getSnapshot().getText();
73
        final CharSequence seq = info.getSnapshot().getText();
(-)a/nbbuild/build.properties (+1 lines)
Lines 204-209 Link Here
204
    sampler,\
204
    sampler,\
205
    spi.editor.hints,\
205
    spi.editor.hints,\
206
    spi.java.hints,\
206
    spi.java.hints,\
207
    java.hints.legacy.spi,\
207
    java.hints.test,\
208
    java.hints.test,\
208
    api.web.webmodule,\
209
    api.web.webmodule,\
209
    xml.xam,\
210
    xml.xam,\

Return to bug 267830