Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java25
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java10
2 files changed, 31 insertions, 4 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java
index 4c83d917ee..f94c7492cf 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java
@@ -8689,6 +8689,31 @@ public class ModuleBuilderTests extends ModifyingResourceTests {
deleteProject("lib");
}
}
+
+ public void testBug558004() throws CoreException {
+ IJavaProject prj = createJava9Project("A");
+ try {
+ String moduleinfopath = "A/src/module-info.java";
+ String moduleinfosrc =
+ "/**\n" +
+ " * The {@link java.nio.file.FileSystems#newFileSystem FileSystems.newFileSystem(URI.create(\"jrt:/\"))}\n" +
+ " */\n" +
+ "module modulartest11 {\n" +
+ "}\n";
+ createFile(moduleinfopath, moduleinfosrc);
+ getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, null);
+ assertNoErrors();
+ this.problemRequestor.initialize(moduleinfosrc.toCharArray());
+ getCompilationUnit("A/src/module-info.java").getWorkingCopy(this.wcOwner, null);
+ assertProblems("unexpected problems",
+ "----------\n" +
+ "----------\n",
+ this.problemRequestor);
+ } finally {
+ deleteProject(prj);
+ }
+ }
+
public void testBug547479() throws CoreException {
int max = org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java
index 087d33fc8f..c00df74cae 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java
@@ -423,7 +423,8 @@ public class Javadoc extends ASTNode {
scope.problemReporter().javadocInvalidValueReference(fieldRef.sourceStart, fieldRef.sourceEnd, scopeModifiers);
}
else if (fieldRef.actualReceiverType != null) {
- if (scope.enclosingSourceType().isCompatibleWith(fieldRef.actualReceiverType)) {
+ SourceTypeBinding stb = scope.enclosingSourceType();
+ if (stb != null && stb.isCompatibleWith(fieldRef.actualReceiverType)) {
fieldRef.bits |= ASTNode.SuperAccess;
}
ReferenceBinding resolvedType = (ReferenceBinding) fieldRef.actualReceiverType;
@@ -964,8 +965,9 @@ public class Javadoc extends ASTNode {
ClassScope topLevelScope = scope.classScope();
// when scope is not on compilation unit type, then inner class may not be visible...
- if (topLevelScope.parent.kind != Scope.COMPILATION_UNIT_SCOPE ||
- !CharOperation.equals(topLevelType.sourceName, topLevelScope.referenceContext.name)) {
+ if (topLevelScope != null &&
+ (topLevelScope.parent.kind != Scope.COMPILATION_UNIT_SCOPE ||
+ !CharOperation.equals(topLevelType.sourceName, topLevelScope.referenceContext.name))) {
topLevelScope = topLevelScope.outerMostClassScope();
if (typeReference instanceof JavadocSingleTypeReference) {
// inner class single reference can only be done in same unit
@@ -1014,7 +1016,7 @@ public class Javadoc extends ASTNode {
// partially qualified references from a different CU should be warned
char[][] typeRefName = ((JavadocQualifiedTypeReference) typeReference).getTypeName();
int skipLength = 0;
- if (topLevelScope.getCurrentPackage() == resolvedType.getPackage()
+ if (topLevelScope != null && topLevelScope.getCurrentPackage() == resolvedType.getPackage()
&& typeRefName.length < computedCompoundName.length) {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=221539: references can be partially qualified
// in same package and hence if the package name is not given, ignore package name check

Back to the top