Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Arthanareeswaran2019-09-09 05:13:45 +0000
committerJay Arthanareeswaran2019-09-09 05:37:14 +0000
commit3cd94c076c46497e51c5910b19d0e8ddf0b8fb31 (patch)
tree9b34be5cdf9095be6a97009a94e6da68dbe660e5
parent88305c2966968457e0d2aa0b76d35d07d7657db2 (diff)
parentc8645ac64da6ad9e7b05904f9dac2245f164a319 (diff)
downloadeclipse.jdt.core-3cd94c076c46497e51c5910b19d0e8ddf0b8fb31.tar.gz
eclipse.jdt.core-3cd94c076c46497e51c5910b19d0e8ddf0b8fb31.tar.xz
eclipse.jdt.core-3cd94c076c46497e51c5910b19d0e8ddf0b8fb31.zip
Merge remote-tracking branch 'origin/master' into BETA_JAVA13Y20190910-0005Y20190909-0900P20190909-0325P20190909-0305P20190909-0235
# Conflicts: # org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java # org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java # org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java Change-Id: I5149c4cc6bd8bb4c5e8d43031cb723b02d117069
-rw-r--r--org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/PackageTests.java4
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java2
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java2
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java4
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests3.java65
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaModelManagerTests.java6
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingSwitchExpressionsTest.java4
-rw-r--r--org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247Jdk12.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java8
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java5
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java5
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrtWithReleaseOption.java29
14 files changed, 98 insertions, 46 deletions
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/PackageTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/PackageTests.java
index 7be3f8b9eb..11340bb252 100644
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/PackageTests.java
+++ b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/PackageTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -109,7 +109,7 @@ public class PackageTests extends BuilderTests {
fullBuild();
expectingOnlySpecificProblemFor(aPath,
- new Problem("", "The type A collides with a package", aPath, 24, 25, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_WARNING)); //$NON-NLS-1$ //$NON-NLS-2$
+ new Problem("", "The type A collides with a package", aPath, 24, 25, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$
expectingOnlySpecificProblemFor(bPath,
new Problem("", "The declared package \"\" does not match the expected package \"p.A\"", bPath, 0, 1, CategorizedProblem.CAT_INTERNAL, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java
index 44a49cd93e..004c2ce08a 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java
@@ -29,6 +29,7 @@ import java.util.Map;
import junit.framework.Test;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.JavacTestOptions.Excuse;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
@@ -10972,6 +10973,7 @@ public void testBug481931_binary() {
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
"Dead code\n" +
"----------\n";
+ runner.javacTestOptions = Excuse.EclipseWarningConfiguredAsError;
runner.runNegativeTest();
}
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java
index ed6a8d63f0..20134ad43b 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java
@@ -17467,7 +17467,7 @@ public void testBug435528_orig() {
"Statement unnecessarily nested within else clause. The corresponding then clause does not complete normally\n" +
"----------\n";
runner.customOptions = getCompilerOptions();
- runner.javacTestOptions = JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings;
+ runner.javacTestOptions = JavacTestOptions.Excuse.EclipseWarningConfiguredAsError;
runner.runNegativeTest();
}
public void testBug435528_notaconstant() {
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java
index 91d76e7547..3a1b07c49e 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -2459,7 +2459,7 @@ public class StaticImportTest extends AbstractComparableTest {
"}\n",
},
"----------\n" +
- "1. WARNING in node\\Test.java (at line 2)\n" +
+ "1. ERROR in node\\Test.java (at line 2)\n" +
" public class Test {\n" +
" ^^^^\n" +
"The type Test collides with a package\n" +
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java
index 4305c244c6..1fef2d022a 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java
@@ -23,7 +23,7 @@ public class SwitchExpressionTest extends AbstractRegressionTest {
static {
// TESTS_NUMBERS = new int [] { 40 };
-// TESTS_NAMES = new String[] { "_testBug543240" };
+// TESTS_NAMES = new String[] { "testBug548476" };
}
public static Class<?> testClass() {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests3.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests3.java
index 77022c605f..bdae7244dd 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests3.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests3.java
@@ -39,7 +39,7 @@ public static Test suite() {
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=338398
public void testBug338398a() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[2];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/A.java",
@@ -74,7 +74,7 @@ public void testBug338398a() throws CoreException {
}
public void _testBug338398b() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[2];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/A_CLASS.java",
@@ -100,7 +100,7 @@ public void _testBug338398b() throws CoreException {
}
public void _testBug338398c() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[2];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/A_CLASS.java",
@@ -126,7 +126,7 @@ public void _testBug338398c() throws CoreException {
}
public void testBug504095() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[2];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Bug504095.java",
@@ -155,7 +155,7 @@ public void testBug504095() throws CoreException {
}
public void testBug425035a() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Values.java",
@@ -196,7 +196,7 @@ public void testBug425035a() throws CoreException {
}
public void testBug425035b() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Values.java",
@@ -236,7 +236,7 @@ public void testBug425035b() throws CoreException {
}
public void testBug425035c() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Values.java",
@@ -277,7 +277,7 @@ public void testBug425035c() throws CoreException {
}
public void testBug425035d() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Values.java",
@@ -317,7 +317,7 @@ public void testBug425035d() throws CoreException {
}
public void testBug425035e() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Values.java",
@@ -357,7 +357,7 @@ public void testBug425035e() throws CoreException {
}
public void testBug425035f() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Values.java",
@@ -398,7 +398,7 @@ public void testBug425035f() throws CoreException {
}
public void testBug425035_method_a() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Values.java",
@@ -442,7 +442,7 @@ public void testBug425035_method_a() throws CoreException {
}
public void testBug425035_method_b() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Values.java",
@@ -485,7 +485,7 @@ public void testBug425035_method_b() throws CoreException {
}
public void testBug425035_method_c() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Values.java",
@@ -529,7 +529,7 @@ public void testBug425035_method_c() throws CoreException {
}
public void testBug425035_method_d() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Values.java",
@@ -572,7 +572,7 @@ public void testBug425035_method_d() throws CoreException {
}
public void testBug425035_method_e() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Values.java",
@@ -615,7 +615,7 @@ public void testBug425035_method_e() throws CoreException {
}
public void testBug425035_method_f() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Values.java",
@@ -657,4 +657,37 @@ public void testBug425035_method_f() throws CoreException {
deleteProject("P");
}
}
+public void testBug547256() throws CoreException {
+ try {
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy(
+ "/P/src/jdt/Something.java",
+ "package jdt;\n" +
+ "public class Something {\n" +
+ " public static void main(String[] args) {\n" +
+ " done: for (int i = 0; i < 5; ++i) {\n" +
+ " if (i == 3) {\n" +
+ " break done;\n" +
+ " }\n" +
+ " System.out.println(i);\n" +
+ " }\n" +
+ " arg\n" +
+ " System.out.println(\"done\");\n" +
+ " }\n" +
+ "}\n");
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.setAllowsRequiredProposals(CompletionProposal.FIELD_REF, CompletionProposal.TYPE_REF, true);
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "arg";
+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults(
+ "args[LOCAL_VARIABLE_REF]{args, null, [Ljava.lang.String;, args, null, 52}",
+ requestor.getResults());
+
+ } finally {
+ deleteProject("P");
+ }
+}
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaModelManagerTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaModelManagerTests.java
index 65b052db75..0567191844 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaModelManagerTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaModelManagerTests.java
@@ -23,11 +23,17 @@ import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.internal.core.JavaElement;
import org.eclipse.jdt.internal.core.nd.indexer.Indexer;
+import junit.framework.Test;
+
public class JavaModelManagerTests extends AbstractJavaModelTests {
private static final IProgressMonitor NULL_MONITOR = new NullProgressMonitor();
private static final String PROJECT_NAME = JavaModelManagerTests.class.getSimpleName();
+ public static Test suite() {
+ return buildModelTestSuite(JavaModelManagerTests.class);
+ }
+
public JavaModelManagerTests(String name) {
super(name);
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingSwitchExpressionsTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingSwitchExpressionsTest.java
index 95464da95b..f7f909287d 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingSwitchExpressionsTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingSwitchExpressionsTest.java
@@ -306,9 +306,7 @@ public class ASTRewritingSwitchExpressionsTest extends ASTRewritingTest {
buf.append(" int z = 100;\n");
buf.append(" break z;\n");
buf.append(" }\n");
- buf.append(" case 100, 200 -> {\n");
- buf.append(" break 2048;\n");
- buf.append("}\n");
+ buf.append(" case 100, 200 -> {break 2048;}\n");
buf.append(" default -> {\n");
buf.append(" break 12;\n");
buf.append(" }\n");
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247Jdk12.java b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247Jdk12.java
index 0709ad5215..c3a28d0239 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247Jdk12.java
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247Jdk12.java
@@ -43,6 +43,7 @@ import org.eclipse.jdt.internal.compiler.util.Util;
public class ClasspathJep247Jdk12 extends ClasspathJep247 {
Map<String, IModule> modules;
+ static String MODULE_INFO = "module-info.sig"; //$NON-NLS-1$
public ClasspathJep247Jdk12(File jdkHome, String release, AccessRuleSet accessRuleSet) {
super(jdkHome, release, accessRuleSet);
@@ -173,9 +174,8 @@ public class ClasspathJep247Jdk12 extends ClasspathJep247 {
public FileVisitResult visitFile(java.nio.file.Path f, BasicFileAttributes attrs) throws IOException {
if (attrs.isDirectory() || f.getNameCount() < 3)
return FileVisitResult.CONTINUE;
- byte[] content = null;
- if (Files.exists(f)) {
- content = JRTUtil.safeReadBytes(f);
+ if (f.getFileName().toString().equals(MODULE_INFO) && Files.exists(f)) {
+ byte[] content = JRTUtil.safeReadBytes(f);
if (content == null)
return FileVisitResult.CONTINUE;
Path m = f.subpath(1, f.getNameCount() - 1);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
index 3f1d8f7817..ed82f7207a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
@@ -9314,7 +9314,7 @@ private SwitchStatement createSwitchStatementOrExpression(boolean isStmt) {
//if some declaration occurs.
this.nestedType--;
this.switchNestingLevel--;
-
+ this.scanner.breakPreviewAllowed = this.switchNestingLevel > 0;
int length;
SwitchStatement switchStatement = isStmt ? new SwitchStatement() : new SwitchExpression();
this.expressionLengthPtr--;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
index 7a6196b7e7..21b462de44 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
@@ -116,6 +116,7 @@ public class Scanner implements TerminalTokens {
public boolean fakeInModule = false;
boolean inCase = false;
/* package */ int yieldColons = -1;
+ boolean breakPreviewAllowed = false;
/**
* The current context of the scanner w.r.t restricted keywords
*
@@ -1305,8 +1306,10 @@ public void ungetToken(int unambiguousToken) {
this.nextToken = unambiguousToken;
}
private void updateCase(int token) {
- if (token == TokenNamecase)
+ if (token == TokenNamecase) {
this.inCase = true;
+ this.breakPreviewAllowed = true;
+ }
if (token == TokenNameCOLON || token == TokenNameARROW)
this.inCase = false;
}
@@ -4896,6 +4899,9 @@ private VanguardParser getVanguardParser() {
this.vanguardScanner.resetTo(this.startPosition, this.eofPosition - 1, isInModuleDeclaration(), this.scanContext);
return this.vanguardParser;
}
+protected final boolean mayBeAtBreakPreview() {
+ return this.breakPreviewAllowed && this.lookBack[1] != TokenNameARROW;
+}
protected final boolean maybeAtLambdaOrCast() { // Could the '(' we saw just now herald a lambda parameter list or a cast expression ? (the possible locations for both are identical.)
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
index 3b9c56234e..f0b386d6ef 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
@@ -1615,13 +1615,12 @@ public int computeSeverity(int problemID){
switch (problemID) {
case IProblem.VarargsConflict :
- return ProblemSeverities.Warning;
- case IProblem.TypeCollidesWithPackage :
- return ProblemSeverities.Warning;
case IProblem.SwitchExpressionsYieldUnqualifiedMethodWarning:
case IProblem.SwitchExpressionsYieldRestrictedGeneralWarning:
case IProblem.SwitchExpressionsYieldTypeDeclarationWarning:
return ProblemSeverities.Warning;
+ case IProblem.TypeCollidesWithPackage :
+ return ProblemSeverities.Error;
/*
* Javadoc tags resolved references errors
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java
index e2ccdb1446..e184a40337 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java
@@ -146,12 +146,13 @@ public class ExternalFoldersManager {
if (externalPath == null || externalPath.isEmpty()) {
return false;
}
-
+
JavaModelManager manager = JavaModelManager.getJavaModelManager();
if (manager.isExternalFile(externalPath) || manager.isAssumedExternalFile(externalPath)) {
return false;
}
- if (!externalPath.isAbsolute() || (WINDOWS && externalPath.getDevice() == null)) {
+ if (!externalPath.isAbsolute()
+ || (WINDOWS && (externalPath.getDevice() == null && !externalPath.isUNC()))) {
// can be only project relative path
return false;
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrtWithReleaseOption.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrtWithReleaseOption.java
index d507ed14dc..5a3dc959fd 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrtWithReleaseOption.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrtWithReleaseOption.java
@@ -51,10 +51,13 @@ import org.eclipse.jdt.internal.core.util.Util;
public class ClasspathJrtWithReleaseOption extends ClasspathJrt {
+ static String MODULE_INFO = "module-info.sig"; //$NON-NLS-1$
+
final String release;
String releaseInHex;
private String[] subReleases;
private java.nio.file.FileSystem fs;
+ protected Path releasePath;
protected Path modulePath;
private String modPathString;
private boolean isJRE12Plus;
@@ -134,15 +137,15 @@ public class ClasspathJrtWithReleaseOption extends ClasspathJrt {
return;
}
}
- Path releasePath = this.fs.getPath("/"); //$NON-NLS-1$
- this.isJRE12Plus = isJRE12Plus(releasePath);
+ this.releasePath = this.fs.getPath("/"); //$NON-NLS-1$
+ this.isJRE12Plus = isJRE12Plus(this.releasePath);
Path modPath = this.fs.getPath(this.releaseInHex + (this.isJRE12Plus ? "" : "-modules")); //$NON-NLS-1$ //$NON-NLS-2$
if (Files.exists(modPath)) {
this.modulePath = modPath;
this.modPathString = this.zipFilename + "|"+ modPath.toString(); //$NON-NLS-1$
}
- if (!Files.exists(releasePath.resolve(this.releaseInHex))) {
+ if (!Files.exists(this.releasePath.resolve(this.releaseInHex))) {
Exception e = new IllegalArgumentException("release " + this.release + " is not found in the system"); //$NON-NLS-1$//$NON-NLS-2$
throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, e.getMessage(), e));
}
@@ -152,7 +155,7 @@ public class ClasspathJrtWithReleaseOption extends ClasspathJrt {
}
if (this.release != null) {
List<String> sub = new ArrayList<>();
- try (DirectoryStream<java.nio.file.Path> stream = Files.newDirectoryStream(releasePath)) {
+ try (DirectoryStream<java.nio.file.Path> stream = Files.newDirectoryStream(this.releasePath)) {
for (final java.nio.file.Path subdir : stream) {
String rel = JRTUtil.sanitizedFileName(subdir);
if (rel.contains(this.releaseInHex)) {
@@ -226,10 +229,12 @@ public class ClasspathJrtWithReleaseOption extends ClasspathJrt {
return;
Set<IModule> cache = ModulesCache.get(jrt.modPathString);
if (cache == null) {
- try (DirectoryStream<java.nio.file.Path> stream = Files.newDirectoryStream(jrt.modulePath)) {
+ try (DirectoryStream<java.nio.file.Path> stream = Files.newDirectoryStream(jrt.releasePath)) {
for (final java.nio.file.Path subdir : stream) {
-
- Files.walkFileTree(subdir, Collections.EMPTY_SET, 1, new FileVisitor<java.nio.file.Path>() {
+ if (!subdir.getFileName().toString().contains(jrt.releaseInHex)) {
+ continue;
+ }
+ Files.walkFileTree(subdir, Collections.EMPTY_SET, 2, new FileVisitor<java.nio.file.Path>() {
@Override
public FileVisitResult preVisitDirectory(java.nio.file.Path dir, BasicFileAttributes attrs)
throws IOException {
@@ -239,14 +244,16 @@ public class ClasspathJrtWithReleaseOption extends ClasspathJrt {
@Override
public FileVisitResult visitFile(java.nio.file.Path f, BasicFileAttributes attrs)
throws IOException {
- byte[] content = null;
- if (Files.exists(f)) {
- content = JRTUtil.safeReadBytes(f);
+ if (attrs.isDirectory() || f.getNameCount() < 3) {
+ return FileVisitResult.CONTINUE;
+ }
+ if (f.getFileName().toString().equals(MODULE_INFO)) {
+ byte[] content = JRTUtil.safeReadBytes(f);
if (content == null)
return FileVisitResult.CONTINUE;
jrt.acceptModule(content);
}
- return FileVisitResult.CONTINUE;
+ return FileVisitResult.SKIP_SIBLINGS;
}
@Override

Back to the top