Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManoj Palat2020-07-06 04:35:57 +0000
committerManoj Palat2020-07-06 11:14:03 +0000
commit6c51200946aefbcdcb9570afc441529525bb5fd4 (patch)
tree1641bcc289359674d6e05835861c2916e5f53a1a
parentb9d03a730db479a0609ca2e5c726b7b99d02241e (diff)
downloadeclipse.jdt.core-Y20200708-1200.tar.gz
eclipse.jdt.core-Y20200708-1200.tar.xz
eclipse.jdt.core-Y20200708-1200.zip
Bug 564830 - [15][sealed] Fix location or message for compile error onY20200708-1200
missing modifiers Change-Id: Ib0e83befbf2a8303b4704ae378159cd4bd03eb80 Signed-off-by: Manoj Palat <manpalat@in.ibm.com>
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SealedTypes15Tests.java24
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java14
3 files changed, 21 insertions, 21 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SealedTypes15Tests.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SealedTypes15Tests.java
index 0e37bbaa9d..60a0873a88 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SealedTypes15Tests.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SealedTypes15Tests.java
@@ -423,7 +423,7 @@ public class SealedTypes15Tests extends AbstractRegressionTest9 {
"----------\n" +
"2. ERROR in p1\\X.java (at line 5)\n" +
" class Z extends X{}\n" +
- " ^\n" +
+ " ^\n" +
"The class Z with a sealed direct superclass or a sealed direct superinterface X should be declared either final, sealed, or non-sealed\n" +
"----------\n" +
"3. ERROR in p1\\X.java (at line 5)\n" +
@@ -460,7 +460,7 @@ public class SealedTypes15Tests extends AbstractRegressionTest9 {
"----------\n" +
"2. ERROR in X.java (at line 3)\n" +
" class Y implements X{}\n" +
- " ^\n" +
+ " ^\n" +
"The class Y with a sealed direct superclass or a sealed direct superinterface X should be declared either final, sealed, or non-sealed\n" +
"----------\n");
}
@@ -487,7 +487,7 @@ public class SealedTypes15Tests extends AbstractRegressionTest9 {
"----------\n" +
"3. ERROR in p1\\X.java (at line 4)\n" +
" class Y implements X{}\n" +
- " ^\n" +
+ " ^\n" +
"The class Y with a sealed direct superclass or a sealed direct superinterface X should be declared either final, sealed, or non-sealed\n" +
"----------\n");
}
@@ -507,7 +507,7 @@ public class SealedTypes15Tests extends AbstractRegressionTest9 {
"----------\n" +
"2. ERROR in X.java (at line 3)\n" +
" class Y extends X {}\n" +
- " ^\n" +
+ " ^\n" +
"The class Y with a sealed direct superclass or a sealed direct superinterface X should be declared either final, sealed, or non-sealed\n" +
"----------\n");
}
@@ -528,7 +528,7 @@ public class SealedTypes15Tests extends AbstractRegressionTest9 {
"----------\n" +
"2. ERROR in p1\\X.java (at line 4)\n" +
" class Y extends X {}\n" +
- " ^\n" +
+ " ^\n" +
"The class Y with a sealed direct superclass or a sealed direct superinterface X should be declared either final, sealed, or non-sealed\n" +
"----------\n");
}
@@ -562,7 +562,7 @@ public class SealedTypes15Tests extends AbstractRegressionTest9 {
"----------\n" +
"1. ERROR in p1\\X.java (at line 4)\n" +
" class Y implements X{}\n" +
- " ^\n" +
+ " ^\n" +
"The class Y with a sealed direct superclass or a sealed direct superinterface X should be declared either final, sealed, or non-sealed\n" +
"----------\n" +
"----------\n" +
@@ -649,7 +649,7 @@ public class SealedTypes15Tests extends AbstractRegressionTest9 {
"----------\n" +
"1. ERROR in X.java (at line 3)\n" +
" interface Y extends X {}\n" +
- " ^\n" +
+ " ^\n" +
"The interface Y with a sealed direct superinterface X should be declared either sealed or non-sealed\n" +
"----------\n");
}
@@ -668,13 +668,13 @@ public class SealedTypes15Tests extends AbstractRegressionTest9 {
"----------\n" +
"1. ERROR in p1\\X.java (at line 4)\n" +
" interface Y extends X{}\n" +
- " ^\n" +
+ " ^\n" +
"The interface Y with a sealed direct superinterface X should be declared either sealed or non-sealed\n" +
"----------\n" +
"----------\n" +
"1. ERROR in p2\\Y.java (at line 2)\n" +
" public interface Y extends p1.X{}\n" +
- " ^^^^\n" +
+ " ^\n" +
"The interface Y with a sealed direct superinterface X should be declared either sealed or non-sealed\n" +
"----------\n" +
"2. ERROR in p2\\Y.java (at line 2)\n" +
@@ -1282,7 +1282,7 @@ public class SealedTypes15Tests extends AbstractRegressionTest9 {
"----------\n" +
"1. ERROR in p1\\X.java (at line 3)\n" +
" class Y extends X {}\n" +
- " ^\n" +
+ " ^\n" +
"The class Y with a sealed direct superclass or a sealed direct superinterface X should be declared either final, sealed, or non-sealed\n" +
"----------\n");
}
@@ -1355,7 +1355,7 @@ public class SealedTypes15Tests extends AbstractRegressionTest9 {
"----------\n" +
"1. ERROR in p1\\Y.java (at line 2)\n" +
" class Y extends X {\n" +
- " ^\n" +
+ " ^\n" +
"The class Y with a sealed direct superclass or a sealed direct superinterface X should be declared either final, sealed, or non-sealed\n" +
"----------\n");
}
@@ -1392,7 +1392,7 @@ public class SealedTypes15Tests extends AbstractRegressionTest9 {
"----------\n" +
"1. ERROR in src\\p\\X.java (at line 2)\n" +
" public class X extends Y {\n" +
- " ^\n" +
+ " ^\n" +
"The class X with a sealed direct superclass or a sealed direct superinterface Y should be declared either final, sealed, or non-sealed\n" +
"----------\n" +
"2. ERROR in src\\p\\X.java (at line 2)\n" +
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
index 1b46a5f181..d14135bb8f 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
@@ -1151,9 +1151,9 @@ private void checkPermitsInType() {
if (foundSealedSuperTypeOrInterface) {
if (!(this.isFinal() || this.isSealed() || this.isNonSealed())) {
if (this.isClass())
- this.scope.problemReporter().sealedMissingClassModifier(this, sealedEntry.getKey(), sealedEntry.getValue());
+ this.scope.problemReporter().sealedMissingClassModifier(this, typeDecl, sealedEntry.getValue());
else if (this.isInterface())
- this.scope.problemReporter().sealedMissingInterfaceModifier(this, sealedEntry.getKey(), sealedEntry.getValue());
+ this.scope.problemReporter().sealedMissingInterfaceModifier(this, typeDecl, sealedEntry.getValue());
}
List<SourceTypeBinding> typesInCU = collectAllTypeBindings(typeDecl, this.scope.compilationUnitScope());
if (typeDecl.superclass != null && !checkPermitsAndAdd(this.superclass, typesInCU))
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 5b7c56ac74..e9029546d2 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
@@ -11846,7 +11846,7 @@ public void recordIllegalExplicitFinalFieldAssignInCompactConstructor(FieldBindi
fieldRef.sourceStart,
fieldRef.sourceEnd);
}
-private void sealedMissingModifier(int problem, SourceTypeBinding type, TypeReference superclass, TypeBinding superTypeBinding) {
+private void sealedMissingModifier(int problem, SourceTypeBinding type, TypeDeclaration typeDecl, TypeBinding superTypeBinding) {
if (!this.options.enablePreviewFeatures)
return;
String name = new String(type.sourceName());
@@ -11857,15 +11857,15 @@ private void sealedMissingModifier(int problem, SourceTypeBinding type, TypeRefe
problem,
new String[] {superTypeFullName, name},
new String[] {superTypeShortName, name},
- superclass.sourceStart,
- superclass.sourceEnd);
+ typeDecl.sourceStart,
+ typeDecl.sourceEnd);
}
-public void sealedMissingClassModifier(SourceTypeBinding type, TypeReference superclass, TypeBinding superTypeBinding) {
- sealedMissingModifier(IProblem.SealedMissingClassModifier, type, superclass, superTypeBinding);
+public void sealedMissingClassModifier(SourceTypeBinding type, TypeDeclaration typeDecl, TypeBinding superTypeBinding) {
+ sealedMissingModifier(IProblem.SealedMissingClassModifier, type, typeDecl, superTypeBinding);
}
-public void sealedMissingInterfaceModifier(SourceTypeBinding type, TypeReference superclass, TypeBinding superTypeBinding) {
- sealedMissingModifier(IProblem.SealedMissingInterfaceModifier, type, superclass, superTypeBinding);
+public void sealedMissingInterfaceModifier(SourceTypeBinding type, TypeDeclaration typeDecl, TypeBinding superTypeBinding) {
+ sealedMissingModifier(IProblem.SealedMissingInterfaceModifier, type, typeDecl, superTypeBinding);
}
public void sealedDisAllowedNonSealedModifierInClass(SourceTypeBinding type, TypeDeclaration typeDecl) {
if (!this.options.enablePreviewFeatures)

Back to the top