Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjay2018-11-26 10:16:26 +0000
committerJay Arthanareeswaran2018-11-29 04:01:42 +0000
commite2b7468d95fff64647905e495bcc8efa650d588c (patch)
tree54a9fe605ba7a0aa7fdce0d47998bd24ea2bbdbd /org.eclipse.jdt.core
parent88ffa8b00ed7028c05521f42ef45b04243f92c61 (diff)
downloadeclipse.jdt.core-e2b7468d95fff64647905e495bcc8efa650d588c.tar.gz
eclipse.jdt.core-e2b7468d95fff64647905e495bcc8efa650d588c.tar.xz
eclipse.jdt.core-e2b7468d95fff64647905e495bcc8efa650d588c.zip
Bug 540067 - [9] An empty compilation unit in a package in a named
module is rejected Change-Id: Iadd25b6e7b722f4f43ab60c71d24d716a3ae08a5 Signed-off-by: jay <jarthana@in.ibm.com>
Diffstat (limited to 'org.eclipse.jdt.core')
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java18
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java2
2 files changed, 16 insertions, 4 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java
index 6ea3c6228b..ea2b9006d5 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -125,8 +125,8 @@ void buildTypeBindings(AccessRestriction accessRestriction) {
moduleDecl.createScope(this);
moduleDecl.checkAndSetModifiers();
}
- } else if (this.environment.module != this.environment.UnNamedModule) {
- problemReporter().unnamedPackageInNamedModule(this.environment.module);
+ } else if (module() != this.environment.UnNamedModule) {
+ problemReporter().unnamedPackageInNamedModule(module());
}
} else {
if ((this.fPackage = this.environment.createPackage(this.currentPackageName)) == null) {
@@ -678,6 +678,18 @@ public int nextCaptureID() {
return this.captureID++;
}
+@Override
+public ModuleBinding module() {
+ if (!this.referenceContext.isModuleInfo() &&
+ this.referenceContext.types == null &&
+ this.referenceContext.currentPackage == null &&
+ this.referenceContext.imports == null) {
+ this.environment = this.environment.UnNamedModule.environment;
+ return this.environment.UnNamedModule;
+ }
+ return super.module();
+}
+
/* Answer the problem reporter to use for raising new problems.
*
* Note that as a side-effect, this updates the current reference context
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java
index da4f2cf817..28ef21f810 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java
@@ -751,7 +751,7 @@ public abstract class Scope {
} while (scope != null);
return (CompilationUnitScope) lastScope;
}
- public final ModuleBinding module() {
+ public ModuleBinding module() {
return environment().module;
}
public boolean isLambdaScope() {

Back to the top