Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2012-09-22 21:42:48 +0000
committerStephan Herrmann2012-09-22 21:42:48 +0000
commit95e290d3c7cf05da65f834fa4e5d2df57058e357 (patch)
treef48fb9604e2120369a6ada5663a338f6be9ab8fb
parent944f7384b95999424cafae705b12b156149c2e01 (diff)
downloadorg.eclipse.objectteams-95e290d3c7cf05da65f834fa4e5d2df57058e357.tar.gz
org.eclipse.objectteams-95e290d3c7cf05da65f834fa4e5d2df57058e357.tar.xz
org.eclipse.objectteams-95e290d3c7cf05da65f834fa4e5d2df57058e357.zip
Bug 390057 - decapsulation warning for final base class is not reported
- fix - the test change is only mildly related: need to set severity to error to actually see it. But the real issue needs an OT/Equinox context.
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java2
-rw-r--r--plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/BaseImportChecker.java8
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/OverridingAccessRestrictions.java20
3 files changed, 20 insertions, 10 deletions
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 bbaafeb00..ddac5d097 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
@@ -11080,6 +11080,8 @@ public void decapsulation(ImportReference type) {
}
public void decapsulationByForcedExport(ReferenceBinding type, ASTNode reference) {
String[] args = { new String(type.readableName()) };
+ if (reference instanceof Expression)
+ ((Expression)reference).tagReportedBaseclassDecapsulation();
this.handle(
IProblem.BaseclassDecapsulationForcedExport,
args,
diff --git a/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/BaseImportChecker.java b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/BaseImportChecker.java
index 351611946..c34505e75 100644
--- a/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/BaseImportChecker.java
+++ b/plugins/org.eclipse.objectteams.otdt.compiler.adaptor/src/org/eclipse/objectteams/otdt/internal/compiler/adaptor/BaseImportChecker.java
@@ -1,7 +1,7 @@
/**********************************************************************
* This file is part of "Object Teams Development Tooling"-Software
*
- * Copyright 2007 Fraunhofer Gesellschaft, Munich, Germany,
+ * Copyright 2007, 2012 Fraunhofer Gesellschaft, Munich, Germany,
* for its Fraunhofer Institute for Computer Architecture and Software
* Technology (FIRST), Berlin, Germany and Technical University Berlin,
* Germany.
@@ -10,7 +10,6 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- * $Id: BaseImportChecker.java 23451 2010-02-04 20:33:32Z stephan $
*
* Please visit http://www.eclipse.org/objectteams for updates and contact.
*
@@ -204,10 +203,7 @@ public team class BaseImportChecker extends CompilationThreadWatcher
if (location instanceof MessageSend)
return DecapsulationState.REPORTED; // callout message send.
Expression expr= (Expression) location;
- DecapsulationState result= expr.getBaseclassDecapsulation();
- if (result == DecapsulationState.ALLOWED)
- expr.tagReportedBaseclassDecapsulation();
- return result;
+ return expr.getBaseclassDecapsulation();
}
if (location instanceof ImportReference) {
ImportReference impRef= (ImportReference)location;
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/OverridingAccessRestrictions.java b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/OverridingAccessRestrictions.java
index 1829ab872..fa046658c 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/OverridingAccessRestrictions.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/OverridingAccessRestrictions.java
@@ -1,7 +1,7 @@
/**********************************************************************
* This file is part of "Object Teams Development Tooling"-Software
*
- * Copyright 2004, 2011 IT Service Omikron GmbH and others.
+ * Copyright 2004, 2012 IT Service Omikron GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -21,9 +21,12 @@ import java.util.Map;
import junit.framework.Test;
+import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+import org.eclipse.objectteams.otdt.core.ext.OTDTPlugin;
import org.eclipse.objectteams.otdt.tests.otjld.AbstractOTJLDTest;
+@SuppressWarnings("unchecked")
public class OverridingAccessRestrictions extends AbstractOTJLDTest {
public OverridingAccessRestrictions(String name) {
@@ -1287,8 +1290,9 @@ public class OverridingAccessRestrictions extends AbstractOTJLDTest {
// a bound base class is final - expect decapsulation warning
// 7.4.6-otjld-baseclass-is-invisible-8
public void test746_baseclassIsInvisible8() {
-
- runConformTest(
+ Map options = getCompilerOptions();
+ options.put(OTDTPlugin.OT_COMPILER_DECAPSULATION, JavaCore.ERROR);
+ runNegativeTest(
new String[] {
"Team746bii8.java",
"\n" +
@@ -1310,7 +1314,15 @@ public class OverridingAccessRestrictions extends AbstractOTJLDTest {
"}\n" +
" \n"
},
- "OK");
+ "----------\n" +
+ "1. ERROR in Team746bii8.java (at line 3)\n" +
+ " public class R playedBy T746bii8 {\n" +
+ " ^^^^^^^^\n" +
+ "PlayedBy binding overrides finalness of base class T746bii8 (OTJLD 2.1.2(c)).\n" +
+ "----------\n",
+ null/*classLibraries*/,
+ true/*shouldFlushOutputDirectory*/,
+ options);
}
// a base imported base class is invisible, suppressing at the role suffices

Back to the top