[GitHub] jlahoda closed pull request #510: [NETBEANS-654] Ignoring InvalidFileException while constructing the J…

2018-04-24 Thread GitBox
jlahoda closed pull request #510: [NETBEANS-654] Ignoring InvalidFileException 
while constructing the J…
URL: https://github.com/apache/incubator-netbeans/pull/510
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/java.source.base/src/org/netbeans/modules/java/source/parsing/JavacParser.java
 
b/java.source.base/src/org/netbeans/modules/java/source/parsing/JavacParser.java
index 78dc9c17b..3aa15da75 100644
--- 
a/java.source.base/src/org/netbeans/modules/java/source/parsing/JavacParser.java
+++ 
b/java.source.base/src/org/netbeans/modules/java/source/parsing/JavacParser.java
@@ -727,9 +727,15 @@ static JavacTaskImpl createJavacTask(
 }
 AbstractSourceFileObject source = null;
 if (file != null) {
-source = FileObjects.sourceFileObject(file, root);
-if (source.getKind() != Kind.SOURCE) {
-source = null;
+try {
+source = FileObjects.sourceFileObject(file, root, null, 
false);
+if (source.getKind() != Kind.SOURCE) {
+source = null;
+}
+} catch (FileObjects.InvalidFileException ife) {
+//ignore, it will be handled again later, see #parse.
+} catch (IOException ex) {
+throw new IllegalStateException(ex);
 }
 }
 final JavacTaskImpl javacTask = createJavacTask(cpInfo,
diff --git 
a/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/JavacParserTest.java
 
b/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/JavacParserTest.java
index b2acdc890..2f9b75bf7 100644
--- 
a/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/JavacParserTest.java
+++ 
b/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/JavacParserTest.java
@@ -315,6 +315,19 @@ public Void scan(Tree tree, long[] parentSpan) {
 }, true);
 }
 
+public void testInvalidFile654() throws Exception {
+FileObject f = createFile("test/Test.java", "package test; class Test 
{ }");
+JavaSource js = JavaSource.forFileObject(f);
+
+
+js.runUserActionTask(new Task() {
+public void run(CompilationController parameter) throws Exception {
+f.delete();
+
assertTrue(Phase.RESOLVED.compareTo(parameter.toPhase(Phase.RESOLVED)) <= 0);
+}
+}, true);
+}
+
 public void testIfMissingObjectOnBootCPUseCPToGuessSourceLevel() throws 
Exception {
 Source ret = guessSourceLevel(false, false, false);
 assertEquals("Downgraded to 1.4", Source.JDK1_4, ret);


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



[GitHub] jtulach commented on a change in pull request #6: Gradle plugin to process the @JavaScriptBody annotations

2018-04-24 Thread GitBox
jtulach commented on a change in pull request #6: Gradle plugin to process the 
@JavaScriptBody annotations
URL: 
https://github.com/apache/incubator-netbeans-html4j/pull/6#discussion_r183935189
 
 

 ##
 File path: 
html4j-maven-plugin/src/main/java/org/netbeans/html/mojo/ProcessJsAnnotationsTask.java
 ##
 @@ -0,0 +1,77 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.html.mojo;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.util.Set;
+import org.gradle.api.DefaultTask;
+import org.gradle.api.GradleException;
+import org.gradle.api.Project;
+
+public class ProcessJsAnnotationsTask extends DefaultTask {
+void processJsAnnotations(final Project p) {
+final Set allSourceSets = (Set) p.findProperty("sourceSets");
+if (allSourceSets == null) {
+throw new GradleException("Cannot find sourceSets for project " + 
p);
+}
+for (Object sourceSet : allSourceSets) {
+ProcessJsAnnotations process = new ProcessJsAnnotations() {
+@Override
+protected void log(String msg) {
+p.getLogger().info(msg);
+}
+};
+Iterable cp = invoke(Iterable.class, sourceSet, 
"getRuntimeClasspath");
+boolean asm = false;
+for (Object elem : cp) {
+final File pathElement = (File) elem;
+process.addClasspathEntry(pathElement);
+if (pathElement.getName().contains("asm")) {
 
 Review comment:
   Removed in e7f8eef4fd0eea08f755378c4891b894617039e6


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



[GitHub] jlahoda opened a new pull request #520: [NETBEANS-317] Ensuring that jars that are augmented with OSGi metada…

2018-04-24 Thread GitBox
jlahoda opened a new pull request #520: [NETBEANS-317] Ensuring that jars that 
are augmented with OSGi metada…
URL: https://github.com/apache/incubator-netbeans/pull/520
 
 
   …ta still get the correct license/notice handling.
   
   (The problem is that files like netbeans/ide/modules/com-jcraft-jsch.jar 
don't have the correct entries in LICENSE and NOTICE, because the OSGi metadata 
are added to them, and so the CRCs of the jar in external and in the binary 
build differ.)
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



[GitHub] neilcsmith-net opened a new pull request #36: Add issues.html for in IDE issue dialog

2018-04-24 Thread GitBox
neilcsmith-net opened a new pull request #36: Add issues.html for in IDE issue 
dialog
URL: https://github.com/apache/incubator-netbeans-website/pull/36
 
 
   Add issues.html for in IDE issue dialog


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



[GitHub] sdedic commented on a change in pull request #519: Netbeans-481[JDK10-LVTI]:Added new ErrorRule to fix compiler error on initialization of var type variable with array

2018-04-24 Thread GitBox
sdedic commented on a change in pull request #519: 
Netbeans-481[JDK10-LVTI]:Added new ErrorRule to fix compiler error on 
initialization of var type variable with array
URL: https://github.com/apache/incubator-netbeans/pull/519#discussion_r183695064
 
 

 ##
 File path: 
java.source.base/src/org/netbeans/modules/java/source/save/CasualDiff.java
 ##
 @@ -1464,8 +1465,77 @@ private int diffVarDef(JCVariableDecl oldT, 
JCVariableDecl newT, int[] bounds) {
 addDimensions = dimension(newT.vartype, -1);
 cLikeArray = vartypeBounds[1] > oldT.pos;
 cLikeArrayChange =  cLikeArray && dimension(oldT.vartype, 
oldT.pos) > addDimensions;
-copyTo(localPointer, vartypeBounds[0]);
+
+/**
+ * Extracting modifier from oldTree using symbol position and
+ * modifier positions when oldT.type is error and vartype
+ * upperbound is not proper.
+ */
+if (oldT.type.getKind() == TypeKind.ERROR && vartypeBounds[1] 
== -1) {
+
+// returns -1 if modifiers not present.
+int modsUpperBound = getCommentCorrectedEndPos(oldT.mods);
+if (modsUpperBound > -1) {
+tokenSequence.move(modsUpperBound);
+tokenSequence.moveNext();
+
+// copying modifiers from oldTree
+if (JavaTokenId.WHITESPACE == 
tokenSequence.token().id()) {
+int offset = tokenSequence.offset();
+copyTo(localPointer, localPointer = offset);
+} else {
+copyTo(localPointer, localPointer = 
modsUpperBound);
+}
+}
+
+tokenSequence.move(localPointer);
+tokenSequence.moveNext();
+int offset = tokenSequence.offset();
+JavaTokenId tokenId = tokenSequence.token().id();
+
+//adding back all 
whitespaces/block-comment/javadoc-comments present in OldTree before variable 
type token.
+while ((tokenId == JavaTokenId.WHITESPACE || tokenId == 
JavaTokenId.BLOCK_COMMENT || tokenId == JavaTokenId.JAVADOC_COMMENT) && offset 
< oldT.sym.pos) {
+printer.print(tokenSequence.token().text().toString());
 
 Review comment:
   Do not use `printer.print` directly, `copyTo()` handles copying with respect 
to guarded blocks.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



[GitHub] sdedic commented on a change in pull request #519: Netbeans-481[JDK10-LVTI]:Added new ErrorRule to fix compiler error on initialization of var type variable with array

2018-04-24 Thread GitBox
sdedic commented on a change in pull request #519: 
Netbeans-481[JDK10-LVTI]:Added new ErrorRule to fix compiler error on 
initialization of var type variable with array
URL: https://github.com/apache/incubator-netbeans/pull/519#discussion_r183695791
 
 

 ##
 File path: 
java.source.base/src/org/netbeans/modules/java/source/save/CasualDiff.java
 ##
 @@ -1464,8 +1465,77 @@ private int diffVarDef(JCVariableDecl oldT, 
JCVariableDecl newT, int[] bounds) {
 addDimensions = dimension(newT.vartype, -1);
 cLikeArray = vartypeBounds[1] > oldT.pos;
 cLikeArrayChange =  cLikeArray && dimension(oldT.vartype, 
oldT.pos) > addDimensions;
-copyTo(localPointer, vartypeBounds[0]);
+
+/**
+ * Extracting modifier from oldTree using symbol position and
+ * modifier positions when oldT.type is error and vartype
+ * upperbound is not proper.
+ */
+if (oldT.type.getKind() == TypeKind.ERROR && vartypeBounds[1] 
== -1) {
+
+// returns -1 if modifiers not present.
+int modsUpperBound = getCommentCorrectedEndPos(oldT.mods);
+if (modsUpperBound > -1) {
+tokenSequence.move(modsUpperBound);
+tokenSequence.moveNext();
+
+// copying modifiers from oldTree
+if (JavaTokenId.WHITESPACE == 
tokenSequence.token().id()) {
+int offset = tokenSequence.offset();
+copyTo(localPointer, localPointer = offset);
+} else {
+copyTo(localPointer, localPointer = 
modsUpperBound);
+}
+}
+
+tokenSequence.move(localPointer);
+tokenSequence.moveNext();
+int offset = tokenSequence.offset();
+JavaTokenId tokenId = tokenSequence.token().id();
+
+//adding back all 
whitespaces/block-comment/javadoc-comments present in OldTree before variable 
type token.
+while ((tokenId == JavaTokenId.WHITESPACE || tokenId == 
JavaTokenId.BLOCK_COMMENT || tokenId == JavaTokenId.JAVADOC_COMMENT) && offset 
< oldT.sym.pos) {
+printer.print(tokenSequence.token().text().toString());
+tokenSequence.moveNext();
+offset = tokenSequence.offset();
+tokenId = tokenSequence.token().id();
+}
+
+// Correcting lower/upper bounds for oldT.vartype tree.
+vartypeBounds[1] = oldT.sym.pos;
+vartypeBounds[0] = offset;
+
+} else {
+copyTo(localPointer, vartypeBounds[0]);
+
+}
+
 localPointer = diffTree(oldT.vartype, newT.vartype, 
vartypeBounds);
+
+/**
+ * For erroneous variable type sometime diffTree function 
return
+ * wrong position. In that scenario only old variable type will
+ * be replaced with new variable type leaving out succeeding
+ * comments tokens present(if any). Below code copies 
successive
+ * tokens after excluding variable type token which will be the
+ * first token.
+ */
+if (oldT.type.getKind() == TypeKind.ERROR && localPointer == 
-1) {
+
+// moving to variable type token
+tokenSequence.move(vartypeBounds[0]);
+tokenSequence.moveNext();
+
+//moving to first token after variable type token.
+tokenSequence.moveNext();
+
+// copying tokens from vartype bounds after excluding 
variable type token.
+int offset = tokenSequence.offset();
+if (offset < vartypeBounds[1]) {
 
 Review comment:
   use `copyUpTo()`, it checks for the boundaries already.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



[GitHub] geertjanw closed pull request #516: [NETBEANS-444] Change all apple.laf.AquaLookAndFeel to com.apple.laf.AquaLookAndFeel…

2018-04-24 Thread GitBox
geertjanw closed pull request #516: [NETBEANS-444] Change all 
apple.laf.AquaLookAndFeel to com.apple.laf.AquaLookAndFeel…
URL: https://github.com/apache/incubator-netbeans/pull/516
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/core.startup/src/org/netbeans/core/startup/CLIOptions.java 
b/core.startup/src/org/netbeans/core/startup/CLIOptions.java
index 9327f1023..b208b3cae 100644
--- a/core.startup/src/org/netbeans/core/startup/CLIOptions.java
+++ b/core.startup/src/org/netbeans/core/startup/CLIOptions.java
@@ -150,7 +150,7 @@ public final int cli(String[] args) {
 } else if ("Windows".equals(ui)) {
 ui = 
"com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
 } else if ("Aqua".equals(ui)) {
-ui = "apple.laf.AquaLookAndFeel";
+ui = "com.apple.laf.AquaLookAndFeel";
 }
 uiClass = Class.forName(ui);
 } catch(ArrayIndexOutOfBoundsException e) {
diff --git 
a/core.startup/test/unit/src/org/netbeans/core/startup/CLIOptionsTest.java 
b/core.startup/test/unit/src/org/netbeans/core/startup/CLIOptionsTest.java
index 4bd319685..d9fbeae1e 100644
--- a/core.startup/test/unit/src/org/netbeans/core/startup/CLIOptionsTest.java
+++ b/core.startup/test/unit/src/org/netbeans/core/startup/CLIOptionsTest.java
@@ -70,7 +70,7 @@ public void testLafId2LafClass () {
 if (Utilities.isMac()) {
 new CLIOptions().cli(new String[] { "--laf", "Aqua" });
 try {
-assertEquals("Must be MacOS", CLIOptions.uiClass, 
Class.forName("apple.laf.AquaLookAndFeel"));
+assertEquals("Must be MacOS", CLIOptions.uiClass, 
Class.forName("com.apple.laf.AquaLookAndFeel"));
 } catch (ClassNotFoundException exc) {
 }
 }
diff --git a/core.windows/src/org/netbeans/core/windows/options/LafPanel.java 
b/core.windows/src/org/netbeans/core/windows/options/LafPanel.java
index 0e3f1e346..abf2d2162 100644
--- a/core.windows/src/org/netbeans/core/windows/options/LafPanel.java
+++ b/core.windows/src/org/netbeans/core/windows/options/LafPanel.java
@@ -204,7 +204,7 @@ private LookAndFeelInfo getCurrentLaF() {
 boolean isAqua = "Aqua".equals(UIManager.getLookAndFeel().getID()); 
//NOI18N
 for( LookAndFeelInfo li : lafs ) {
 if( currentLAFClassName.equals( li.getClassName() ) 
-|| (isAqua && 
li.getClassName().contains("apple.laf.AquaLookAndFeel")) ) { //NOI18N
+|| (isAqua && 
li.getClassName().contains("com.apple.laf.AquaLookAndFeel")) ) { //NOI18N
 currentLaf = li;
 break;
 }
@@ -220,7 +220,7 @@ private LookAndFeelInfo getPreferredLaF() {
 boolean isAqua = "Aqua".equals(UIManager.getLookAndFeel().getID()); 
//NOI18N
 for( LookAndFeelInfo li : lafs ) {
 if( lafClassName.equals( li.getClassName() )
-|| (isAqua && 
li.getClassName().contains("apple.laf.AquaLookAndFeel")) ) { //NOI18N
+|| (isAqua && 
li.getClassName().contains("com.apple.laf.AquaLookAndFeel")) ) { //NOI18N
 currentLaf = li;
 break;
 }
diff --git a/ide/launcher/macosx/NetBeansLauncher/NBPreferences.m 
b/ide/launcher/macosx/NetBeansLauncher/NBPreferences.m
index b777d97ef..ed0f3a276 100644
--- a/ide/launcher/macosx/NetBeansLauncher/NBPreferences.m
+++ b/ide/launcher/macosx/NetBeansLauncher/NBPreferences.m
@@ -34,7 +34,7 @@ @implementation NBPreferences
 
 #define DEFAULT_LOOKFEEL 0
 #define LOOKFEEL_STRING @"--laf"
-NSString 
*look_and_feels[]={@"apple.laf.AquaLookAndFeel",@"javax.swing.plaf.metal.MetalLookAndFeel"};
+NSString 
*look_and_feels[]={@"com.apple.laf.AquaLookAndFeel",@"javax.swing.plaf.metal.MetalLookAndFeel"};
 
 #define DEFAULT_USERDIR @""
 #define USERDIR_STRING @"--userdir"
diff --git a/nbi/engine/src/org/netbeans/installer/utils/UiUtils.java 
b/nbi/engine/src/org/netbeans/installer/utils/UiUtils.java
index d2cd9045c..0d1c33e24 100644
--- a/nbi/engine/src/org/netbeans/installer/utils/UiUtils.java
+++ b/nbi/engine/src/org/netbeans/installer/utils/UiUtils.java
@@ -554,7 +554,7 @@ private UiUtils() {
 MOTIF("motif", "Motif", 
"com.sun.java.swing.plaf.motif.MotifLookAndFeel"),
 GTK("gtk", "GTK", "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"),
 METAL("metal", "Metal", "javax.swing.plaf.metal.MetalLookAndFeel"),
-AQUA("aqua", "Aqua", "apple.laf.AquaLookAndFeel"),
+AQUA("aqua", "Aqua", "com.apple.laf.AquaLookAndFeel"),
 NIMBUS("nimbus", "Nimbus", 
"com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"),
 DEFAULT("default", null, 

[GitHub] sdedic commented on a change in pull request #509: [NETBEANS-498] JDK10-LVTI: Provide fix hint to convert var to explicit type

2018-04-24 Thread GitBox
sdedic commented on a change in pull request #509: [NETBEANS-498] JDK10-LVTI: 
Provide fix hint to convert var to explicit type
URL: https://github.com/apache/incubator-netbeans/pull/509#discussion_r183621942
 
 

 ##
 File path: 
java.hints/test/unit/src/org/netbeans/modules/java/hints/jdk/ConvertVarToExplicitTypeTest.java
 ##
 @@ -0,0 +1,272 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.hints.jdk;
+
+import org.junit.Test;
+import org.netbeans.modules.java.hints.test.api.HintTest;
+
+/**
+ *
+ * @author rtaneja
+ */
+public class ConvertVarToExplicitTypeTest {
+private static final String VAR_CONV_DESC = "Convert var to explicit 
type";//NOI18N
+private static final String VAR_CONV_WARNING = "verifier:" + 
VAR_CONV_DESC; //NOI18N
+
+@Test
+public void testConvertVartoIntType() throws Exception {
+HintTest.create()
+.setCaretMarker('^')
+.input("package test;\n"
++ "public class Test {\n"
++ "void m1() {\n"
++ "@Deprecated /*some var*/final /*s*/var var 
= 10^;//s\n"
++ "}\n"
++ "}\n")
+.sourceLevel("1.10")
+.run(ConvertVarToExplicitType.class)
+.findWarning("3:8-3:56:"+ VAR_CONV_WARNING)
+.applyFix()
+.assertCompilable()
+.assertVerbatimOutput("package test;\n"
++ "public class Test {\n"
++ "void m1() {\n"
++ "@Deprecated /*some var*/final /*s*/int var 
= 10;//s\n"
++ "}\n"
++ "}\n");
+}
+
+@Test
+public void testConvertVarToString() throws Exception {
+HintTest.create()
+.setCaretMarker('^')
+.input("package test;\n"
++ "public class Test {\n"
++ "void m1() {\n"
++ "var str = \"Hello\"^;\n"
++ "}\n"
++ "}\n")
+.sourceLevel("1.10")
+.run(ConvertVarToExplicitType.class)
+.findWarning("3:8-3:26:" + VAR_CONV_WARNING)
+.applyFix()
+.assertCompilable()
+.assertVerbatimOutput("package test;\n"
++ "public class Test {\n"
++ "void m1() {\n"
++ "String str = \"Hello\";\n"
++ "}\n"
++ "}\n");
+}
+
+@Test
+public void testVartoHashMap() throws Exception {
+HintTest.create()
+.setCaretMarker('^')
+.input("package test;\n"
++ "import java.util.HashMap;\n"
++ "public class Test {\n"
++ "{\n"
++ "final var map = new HashMap()^;\n"
++ "}\n"
++ "}\n")
+.sourceLevel("1.10")
+.run(ConvertVarToExplicitType.class)
+.findWarning("4:8-4:54:" + VAR_CONV_WARNING)
+.applyFix()
+.assertCompilable()
+.assertVerbatimOutput("package test;\n"
++ "import java.util.HashMap;\n"
++ "public class Test {\n"
++ "{\n"
++ "final HashMap map = new 
HashMap();\n"
++ "}\n"
++ "}\n");
+}
+
+@Test
+public void testVarHintForAnonymousObjType() throws Exception {
+HintTest.create()
+.setCaretMarker('^')
+.input("package test;\n"
++ "public class Test {\n"
++ "void m1() {\n"
++ "var r = new Runnable()^ {\n"
++ "   

[GitHub] sdedic commented on a change in pull request #509: [NETBEANS-498] JDK10-LVTI: Provide fix hint to convert var to explicit type

2018-04-24 Thread GitBox
sdedic commented on a change in pull request #509: [NETBEANS-498] JDK10-LVTI: 
Provide fix hint to convert var to explicit type
URL: https://github.com/apache/incubator-netbeans/pull/509#discussion_r183620127
 
 

 ##
 File path: 
java.hints/src/org/netbeans/modules/java/hints/jdk/ConvertVarToExplicitType.java
 ##
 @@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.hints.jdk;
+
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.tree.ExpressionTree;
+import com.sun.source.tree.Scope;
+import com.sun.source.tree.Tree;
+import com.sun.source.tree.VariableTree;
+import com.sun.source.util.TreePath;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.ElementKind;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
+import javax.tools.Diagnostic;
+import org.netbeans.api.java.source.CompilationInfo;
+import org.netbeans.api.java.source.ElementHandle;
+import org.netbeans.api.java.source.JavaSource;
+import org.netbeans.api.java.source.TreeMaker;
+import org.netbeans.api.java.source.WorkingCopy;
+import org.netbeans.spi.editor.hints.ErrorDescription;
+import org.netbeans.spi.java.hints.ErrorDescriptionFactory;
+import org.netbeans.spi.java.hints.Hint;
+import org.netbeans.spi.java.hints.HintContext;
+import org.netbeans.spi.java.hints.JavaFix;
+import org.netbeans.spi.java.hints.JavaFix.TransformationContext;
+import org.netbeans.spi.java.hints.TriggerPattern;
+import org.openide.util.NbBundle.Messages;
+
+/**
+ * Hint to convert type in local variable declaration from 'var' to explicit
+ * type
+ *
+ * @author rtaneja
+ */
+@Hint(displayName = "#DN_ConvertVarToExplicitType", description = 
"#DESC_ConvertVarToExplicitType", category = "rules15", minSourceVersion = "10")
+@Messages("MSG_ConvertibleToExplicitType=Convert var to explicit type")
+public class ConvertVarToExplicitType {
+
+@TriggerPattern("$mods$ $type $var = $init") //NOI18N
+public static ErrorDescription convertVarToExplicitType(HintContext ctx) {
+
+if (!isLocalVarType(ctx)) {
+return null;
+}
+TreePath treePath = ctx.getPath();
+
+TreePath initTreePath = ctx.getVariables().get("$init");  //NOI18N
+ExpressionTree t = 
ctx.getInfo().getTreeUtilities().parseExpression(initTreePath.getLeaf().toString(),
 null);
+Scope s = ctx.getInfo().getTrees().getScope(ctx.getPath());
+TypeMirror initTypeMirror = 
ctx.getInfo().getTreeUtilities().attributeTree(t, s);
+
+TypeMirror variableTypeMiror = 
ctx.getInfo().getTrees().getElement(treePath).asType();
+
+// variable initializer type should be same as variable type.
+if ((variableTypeMiror.getKind() == TypeKind.ERROR) || 
(!ctx.getInfo().getTypes().isSameType(variableTypeMiror, initTypeMirror))) {
 
 Review comment:
   Better use `Utilities.isValidType()`, it catches more situations than just 
`TypeKind.ERROR`.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



[GitHub] sdedic commented on a change in pull request #509: [NETBEANS-498] JDK10-LVTI: Provide fix hint to convert var to explicit type

2018-04-24 Thread GitBox
sdedic commented on a change in pull request #509: [NETBEANS-498] JDK10-LVTI: 
Provide fix hint to convert var to explicit type
URL: https://github.com/apache/incubator-netbeans/pull/509#discussion_r183619982
 
 

 ##
 File path: 
java.hints/src/org/netbeans/modules/java/hints/jdk/ConvertVarToExplicitType.java
 ##
 @@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.hints.jdk;
+
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.tree.ExpressionTree;
+import com.sun.source.tree.Scope;
+import com.sun.source.tree.Tree;
+import com.sun.source.tree.VariableTree;
+import com.sun.source.util.TreePath;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.ElementKind;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
+import javax.tools.Diagnostic;
+import org.netbeans.api.java.source.CompilationInfo;
+import org.netbeans.api.java.source.ElementHandle;
+import org.netbeans.api.java.source.JavaSource;
+import org.netbeans.api.java.source.TreeMaker;
+import org.netbeans.api.java.source.WorkingCopy;
+import org.netbeans.spi.editor.hints.ErrorDescription;
+import org.netbeans.spi.java.hints.ErrorDescriptionFactory;
+import org.netbeans.spi.java.hints.Hint;
+import org.netbeans.spi.java.hints.HintContext;
+import org.netbeans.spi.java.hints.JavaFix;
+import org.netbeans.spi.java.hints.JavaFix.TransformationContext;
+import org.netbeans.spi.java.hints.TriggerPattern;
+import org.openide.util.NbBundle.Messages;
+
+/**
+ * Hint to convert type in local variable declaration from 'var' to explicit
+ * type
+ *
+ * @author rtaneja
+ */
+@Hint(displayName = "#DN_ConvertVarToExplicitType", description = 
"#DESC_ConvertVarToExplicitType", category = "rules15", minSourceVersion = "10")
+@Messages("MSG_ConvertibleToExplicitType=Convert var to explicit type")
+public class ConvertVarToExplicitType {
+
+@TriggerPattern("$mods$ $type $var = $init") //NOI18N
+public static ErrorDescription convertVarToExplicitType(HintContext ctx) {
+
+if (!isLocalVarType(ctx)) {
+return null;
+}
+TreePath treePath = ctx.getPath();
+
+TreePath initTreePath = ctx.getVariables().get("$init");  //NOI18N
+ExpressionTree t = 
ctx.getInfo().getTreeUtilities().parseExpression(initTreePath.getLeaf().toString(),
 null);
+Scope s = ctx.getInfo().getTrees().getScope(ctx.getPath());
+TypeMirror initTypeMirror = 
ctx.getInfo().getTreeUtilities().attributeTree(t, s);
 
 Review comment:
   Is it necessary to attribute the tree - does not 
`ctx.getInfo().getTypes().getTypeMirror(initTreePath)` work ?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



[GitHub] sdedic commented on a change in pull request #509: [NETBEANS-498] JDK10-LVTI: Provide fix hint to convert var to explicit type

2018-04-24 Thread GitBox
sdedic commented on a change in pull request #509: [NETBEANS-498] JDK10-LVTI: 
Provide fix hint to convert var to explicit type
URL: https://github.com/apache/incubator-netbeans/pull/509#discussion_r183621542
 
 

 ##
 File path: 
java.hints/src/org/netbeans/modules/java/hints/jdk/ConvertVarToExplicitType.java
 ##
 @@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.hints.jdk;
+
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.tree.ExpressionTree;
+import com.sun.source.tree.Scope;
+import com.sun.source.tree.Tree;
+import com.sun.source.tree.VariableTree;
+import com.sun.source.util.TreePath;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.ElementKind;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
+import javax.tools.Diagnostic;
+import org.netbeans.api.java.source.CompilationInfo;
+import org.netbeans.api.java.source.ElementHandle;
+import org.netbeans.api.java.source.JavaSource;
+import org.netbeans.api.java.source.TreeMaker;
+import org.netbeans.api.java.source.WorkingCopy;
+import org.netbeans.spi.editor.hints.ErrorDescription;
+import org.netbeans.spi.java.hints.ErrorDescriptionFactory;
+import org.netbeans.spi.java.hints.Hint;
+import org.netbeans.spi.java.hints.HintContext;
+import org.netbeans.spi.java.hints.JavaFix;
+import org.netbeans.spi.java.hints.JavaFix.TransformationContext;
+import org.netbeans.spi.java.hints.TriggerPattern;
+import org.openide.util.NbBundle.Messages;
+
+/**
+ * Hint to convert type in local variable declaration from 'var' to explicit
+ * type
+ *
+ * @author rtaneja
+ */
+@Hint(displayName = "#DN_ConvertVarToExplicitType", description = 
"#DESC_ConvertVarToExplicitType", category = "rules15", minSourceVersion = "10")
+@Messages("MSG_ConvertibleToExplicitType=Convert var to explicit type")
+public class ConvertVarToExplicitType {
+
+@TriggerPattern("$mods$ $type $var = $init") //NOI18N
+public static ErrorDescription convertVarToExplicitType(HintContext ctx) {
+
+if (!isLocalVarType(ctx)) {
+return null;
+}
+TreePath treePath = ctx.getPath();
+
+TreePath initTreePath = ctx.getVariables().get("$init");  //NOI18N
+ExpressionTree t = 
ctx.getInfo().getTreeUtilities().parseExpression(initTreePath.getLeaf().toString(),
 null);
+Scope s = ctx.getInfo().getTrees().getScope(ctx.getPath());
+TypeMirror initTypeMirror = 
ctx.getInfo().getTreeUtilities().attributeTree(t, s);
+
+TypeMirror variableTypeMiror = 
ctx.getInfo().getTrees().getElement(treePath).asType();
+
+// variable initializer type should be same as variable type.
+if ((variableTypeMiror.getKind() == TypeKind.ERROR) || 
(!ctx.getInfo().getTypes().isSameType(variableTypeMiror, initTypeMirror))) {
+return null;
+}
+return ErrorDescriptionFactory.forTree(ctx, ctx.getPath(), 
Bundle.MSG_ConvertibleToExplicitType(),
+new JavaFixImpl(ctx.getInfo(), ctx.getPath()).toEditorFix());
+}
+
+/**
+ * Fix for converting local 'var' type to explicit variable type
+ *
+ */
+private static final class JavaFixImpl extends JavaFix {
+
+public JavaFixImpl(CompilationInfo info, TreePath tp) {
+super(info, tp);
+}
+
+@Override
+@Messages("FIX_convertVarToExplicitType=Replace var with explicit 
type")
+protected String getText() {
+return Bundle.FIX_convertVarToExplicitType();
+}
+
+@Override
+protected void performRewrite(TransformationContext tc) throws 
Exception {
+WorkingCopy wc = tc.getWorkingCopy();
+CompilationUnitTree cut = wc.getCompilationUnit();
+TreePath statementPath = tc.getPath();
+
+TreeMaker make = wc.getTreeMaker();
+
+if (statementPath.getLeaf().getKind() == Tree.Kind.VARIABLE) {
+VariableTree oldVariableTree = (VariableTree) 
statementPath.getLeaf();
+   

[GitHub] geertjanw commented on issue #509: [NETBEANS-498] JDK10-LVTI: Provide fix hint to convert var to explicit type

2018-04-24 Thread GitBox
geertjanw commented on issue #509: [NETBEANS-498] JDK10-LVTI: Provide fix hint 
to convert var to explicit type
URL: 
https://github.com/apache/incubator-netbeans/pull/509#issuecomment-383821290
 
 
   Any reason not to merge? Looks good to me.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



[GitHub] geertjanw commented on issue #516: [NETBEANS-444] Change all apple.laf.AquaLookAndFeel to com.apple.laf.AquaLookAndFeel…

2018-04-24 Thread GitBox
geertjanw commented on issue #516: [NETBEANS-444] Change all 
apple.laf.AquaLookAndFeel to com.apple.laf.AquaLookAndFeel…
URL: 
https://github.com/apache/incubator-netbeans/pull/516#issuecomment-383820807
 
 
   Great. Should we merge this?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



[GitHub] geertjanw closed pull request #494: Adding LICENSE/NOTICE/DISCLAIMER to NBMs, packing OSGi jars into NBMs…

2018-04-24 Thread GitBox
geertjanw closed pull request #494: Adding LICENSE/NOTICE/DISCLAIMER to NBMs, 
packing OSGi jars into NBMs…
URL: https://github.com/apache/incubator-netbeans/pull/494
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/apisupport.harness/build.xml b/apisupport.harness/build.xml
index 45ccec305..b305b9a8b 100644
--- a/apisupport.harness/build.xml
+++ b/apisupport.harness/build.xml
@@ -24,14 +24,14 @@
 
 
 
-
+
 
 
 
 
 
 
-
+
 
 
 
diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/MakeNBM.java 
b/nbbuild/antsrc/org/netbeans/nbbuild/MakeNBM.java
index ad0ae3bac..f8524e387 100644
--- a/nbbuild/antsrc/org/netbeans/nbbuild/MakeNBM.java
+++ b/nbbuild/antsrc/org/netbeans/nbbuild/MakeNBM.java
@@ -39,6 +39,7 @@
 import java.util.Date;
 import java.util.Enumeration;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Locale;
@@ -46,6 +47,7 @@
 import java.util.Properties;
 import java.util.Set;
 import java.util.StringTokenizer;
+import java.util.function.Supplier;
 import java.util.jar.Attributes;
 import java.util.jar.Attributes.Name;
 import java.util.jar.JarEntry;
@@ -301,12 +303,13 @@ public void setAlias(String s) {
 private boolean isStandardInclude = true;
 private ArrayList externalPackages = null;
 private ArrayList locales = null;
-private ArrayList moduleAttributes = null;
 private Attributes englishAttr = null;
 private Path updaterJar;
 private FileSet executablesSet;
+private ZipFileSet extraNBMFiles;
 private boolean usePack200;
 private String pack200excludes;
+private boolean alwaysCreateNBM;
 
 /** Try to find and create localized info.xml files */
 public void setLocales(String s) {
@@ -340,11 +343,19 @@ public void setPack200Excludes(String pack200excludes) {
 this.pack200excludes = pack200excludes;
 }
 
+public void setAlwaysCreateNBM(boolean alwaysCreateNBM) {
+this.alwaysCreateNBM = alwaysCreateNBM;
+}
+
 /** List of executable files in NBM concatinated by ${line.separator}. */
 public FileSet createExecutables() {
 return (executablesSet = new FileSet());
 }
 
+public ZipFileSet createExtraNBMFiles() {
+return (extraNBMFiles = new ZipFileSet());
+}
+
 /** Module manifest needed for versioning.
  * @deprecated Use {@link #setModule} instead.
  */
@@ -496,6 +507,8 @@ private Attributes getModuleAttributesForLocale(String 
locale) throws BuildExcep
 try {
 try (JarFile mjar = new JarFile(mfile)) {
 if 
(mjar.getManifest().getMainAttributes().getValue("Bundle-SymbolicName") != 
null) {
+englishAttr = new Attributes();
+englishAttr.putValue("OpenIDE-Module", 
JarWithModuleAttributes.extractCodeName(mjar.getManifest().getMainAttributes()));
 // #181025: treat bundles specially.
 return null;
 }
@@ -581,25 +594,30 @@ public void execute () throws BuildException {
overrideLicenseIfNeeded() ;
 
 
-moduleAttributes = new ArrayList<> ();
+Map moduleAttributes = new 
LinkedHashMap<>();
 File module = new File( productDir, moduleName );
 Attributes attr = getModuleAttributesForLocale("");
 if (attr == null) {
-// #181025: OSGi bundle, copy unmodified.
-Copy copy = new Copy();
-copy.setProject(getProject());
-copy.setOwningTarget(getOwningTarget());
-copy.setFile(module);
-copy.setTofile(new 
File(nbm.getAbsolutePath().replaceFirst("[.]nbm$", ".jar")));
-copy.execute();
-// XXX possibly sign it
-// XXX could try to run pack200, though not if it was signed
-return;
+if (!alwaysCreateNBM) {
+// #181025: OSGi bundle, copy unmodified.
+Copy copy = new Copy();
+copy.setProject(getProject());
+copy.setOwningTarget(getOwningTarget());
+copy.setFile(module);
+copy.setTofile(new 
File(nbm.getAbsolutePath().replaceFirst("[.]nbm$", ".jar")));
+copy.execute();
+// XXX possibly sign it
+// XXX could try to run pack200, though not if it was signed
+return;
+} else {
+moduleAttributes.put("", () -> createFakeOSGiInfo(module));
+}
+} else {
+moduleAttributes.put("", () -> createInfoXml(attr));
  

[GitHub] Chris2011 commented on issue #481: [NETBEANS-290] Provided support for hyperlink on dependencies.

2018-04-24 Thread GitBox
Chris2011 commented on issue #481: [NETBEANS-290] Provided support for 
hyperlink on dependencies.
URL: 
https://github.com/apache/incubator-netbeans/pull/481#issuecomment-383815316
 
 
   Thx @mcdonnell-john and no worries. It is as it is :). I'm/we're waiting for 
it as long as it takes. So as I see it right, you added the NPE check, right? 
If yes, will check it again.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists