Bug 547646 - [reconcile] opening BaseImportChecker in an editor shows
'Unnecessary @SuppressWarnings("basecall")'
diff --git a/maven/.classpath b/maven/.classpath
new file mode 100644
index 0000000..a1a13d3
--- /dev/null
+++ b/maven/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="src" path="objectteams-weaver-maven-plugin/src/main/java"/>
+ <classpathentry kind="src" path="testproject/src/main/java"/>
+ <classpathentry kind="src" path="testproject/src/test/java"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/maven/.project b/maven/.project
new file mode 100644
index 0000000..cb84216
--- /dev/null
+++ b/maven/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>maven</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java
index bca7875..6693e6b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java
@@ -409,7 +409,7 @@
{
if (!this.ignoreFurtherInvestigation)
new BytecodeTransformer().checkCopyMethodCode(classFile, this);
- if (this.binding.bytecodeMissing) { // copy did not succeed
+ if (this.binding.bytecodeMissing && !Config.getConfig().ignoreMissingBytecode) { // copy did not succeed
int problemsLength;
CategorizedProblem[] problems =
this.scope.referenceCompilationUnit().compilationResult.getProblems();
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
index db0db84..a9be73b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
@@ -419,7 +419,7 @@
if(isRelevantCopied())
{
new BytecodeTransformer().checkCopyMethodCode(classFile, this);
- if (this.binding.bytecodeMissing) { // copy did not succeed
+ if (this.binding.bytecodeMissing && !Config.getConfig().ignoreMissingBytecode) { // copy did not succeed
int problemsLength;
CategorizedProblem[] problems =
this.scope.referenceCompilationUnit().compilationResult.getProblems();
diff --git a/othersrc/JCLMin1.8/src/java/lang/Integer.java b/othersrc/JCLMin1.8/src/java/lang/Integer.java
index 4fe8a52..5d53608 100644
--- a/othersrc/JCLMin1.8/src/java/lang/Integer.java
+++ b/othersrc/JCLMin1.8/src/java/lang/Integer.java
@@ -2,4 +2,5 @@
public class Integer {
public int intValue() { return 0; }
+ public static Integer valueOf(int i) { return null; }
}
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/JCL/jclMin1.8.jar b/testplugins/org.eclipse.objectteams.otdt.test.builder/JCL/jclMin1.8.jar
index 0e017da..ab518e9 100644
--- a/testplugins/org.eclipse.objectteams.otdt.test.builder/JCL/jclMin1.8.jar
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/JCL/jclMin1.8.jar
Binary files differ
diff --git a/testplugins/org.eclipse.objectteams.otdt.test.builder/JCL/jclMin1.8src.zip b/testplugins/org.eclipse.objectteams.otdt.test.builder/JCL/jclMin1.8src.zip
index c85ea26..a5b98c8 100644
--- a/testplugins/org.eclipse.objectteams.otdt.test.builder/JCL/jclMin1.8src.zip
+++ b/testplugins/org.eclipse.objectteams.otdt.test.builder/JCL/jclMin1.8src.zip
Binary files differ
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/JCL/jclMin1.8.jar b/testplugins/org.eclipse.objectteams.otdt.tests/JCL/jclMin1.8.jar
index 6811e28..ab518e9 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/JCL/jclMin1.8.jar
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/JCL/jclMin1.8.jar
Binary files differ
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/JCL/jclMin1.8src.zip b/testplugins/org.eclipse.objectteams.otdt.tests/JCL/jclMin1.8src.zip
index 06a502f..a5b98c8 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/JCL/jclMin1.8src.zip
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/JCL/jclMin1.8src.zip
Binary files differ
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/model/org/eclipse/objectteams/otdt/tests/otmodel/OTReconcilerTests.java b/testplugins/org.eclipse.objectteams.otdt.tests/model/org/eclipse/objectteams/otdt/tests/otmodel/OTReconcilerTests.java
index 22430e7..f9ef881 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/model/org/eclipse/objectteams/otdt/tests/otmodel/OTReconcilerTests.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/model/org/eclipse/objectteams/otdt/tests/otmodel/OTReconcilerTests.java
@@ -589,7 +589,7 @@
ICompilationUnit wc = getCompilationUnit("/P/Foo/Role2.java").getWorkingCopy(this.wcOwner, null);
- wc.reconcile(AST.JLS10,
+ wc.reconcile(AST.JLS12,
ICompilationUnit.FORCE_PROBLEM_DETECTION|ICompilationUnit.ENABLE_STATEMENTS_RECOVERY|ICompilationUnit.ENABLE_BINDINGS_RECOVERY,
wc.getOwner(), null);
@@ -657,7 +657,7 @@
" String s1, s2, s3, s4, s5, s6;\n" +
" }\n").length()),
null);
- wc.reconcile(AST.JLS10,
+ wc.reconcile(AST.JLS12,
ICompilationUnit.FORCE_PROBLEM_DETECTION|ICompilationUnit.ENABLE_STATEMENTS_RECOVERY|ICompilationUnit.ENABLE_BINDINGS_RECOVERY,
wc.getOwner(), null);
@@ -2457,7 +2457,77 @@
deleteProject("P");
}
}
-
+
+ public void testBug547646() throws CoreException, InterruptedException {
+ try {
+ // Resources creation
+ IJavaProject p = createOTJavaProject("P", new String[] {"src"}, new String[] {"JCL18_LIB"}, "1.8", "bin");
+ IProject project = p.getProject();
+ IProjectDescription prjDesc = project.getDescription();
+ prjDesc.setBuildSpec(OTDTPlugin.createProjectBuildCommands(prjDesc));
+ project.setDescription(prjDesc, null);
+ p.setOption(JavaCore.COMPILER_PB_UNUSED_WARNING_TOKEN, JavaCore.ERROR);
+
+ OTREContainer.initializeOTJProject(project);
+
+ createFile(
+ "/P/src/Foo0.java",
+ "public team class Foo0 {\n" +
+ " protected class R {\n" +
+ " void m() {}\n" + // byte code of this method will not be available during reconcile of the sub-team
+ " }\n" +
+ "}\n"
+ );
+
+ // trigger 110 suppressed warnings:
+ StringBuilder attributes = new StringBuilder();
+ for (int i=0; i<110; i++)
+ attributes.append("@SuppressWarnings(\"unused\") private int i"+i+";\n");
+
+ String sourceFoo =
+ "public team class Foo extends Foo0 {\n" +
+ attributes.toString() +
+ " protected class R {\n" +
+ " @SuppressWarnings(\"basecall\")\n" +
+ " callin void roleMethod(int f, String both) {\n" +
+ " switch (f) {\n" +
+ " case 1:\n" +
+ " m();\n" +
+ " break;\n" +
+ " default:\n" +
+ " base.roleMethod(f, both);\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
+ "}\n";
+ this.createFile(
+ "/P/src/Foo.java",
+ sourceFoo
+ );
+
+ char[] sourceChars = sourceFoo.toCharArray();
+ this.problemRequestor.initialize(sourceChars);
+
+ ICompilationUnit fooWC = getCompilationUnit("/P/src/Foo.java").getWorkingCopy(this.wcOwner, null);
+ assertProblems("Unexpected problems",
+ "----------\n" +
+ "----------\n");
+
+ this.problemRequestor.initialize(sourceChars);
+ fooWC.reconcile(AST.JLS12,
+ ICompilationUnit.FORCE_PROBLEM_DETECTION|ICompilationUnit.ENABLE_STATEMENTS_RECOVERY|ICompilationUnit.ENABLE_BINDINGS_RECOVERY,
+ fooWC.getOwner(), null);
+
+ assertProblems(
+ "Unexpected problems",
+ "----------\n" +
+ "----------\n"
+ );
+ } finally {
+ deleteProject("P");
+ }
+ }
+
private void createRuntimeStubs() throws CoreException {
createFolder("/P/org/objectteams");
createFile("/P/org/objectteams/ITeam.java",
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.dom/JCL/jclMin1.8.jar b/testplugins/org.eclipse.objectteams.otdt.ui.tests.dom/JCL/jclMin1.8.jar
index 6811e28..ab518e9 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.dom/JCL/jclMin1.8.jar
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.dom/JCL/jclMin1.8.jar
Binary files differ
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.dom/JCL/jclMin1.8src.zip b/testplugins/org.eclipse.objectteams.otdt.ui.tests.dom/JCL/jclMin1.8src.zip
index 06a502f..a5b98c8 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.dom/JCL/jclMin1.8src.zip
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.dom/JCL/jclMin1.8src.zip
Binary files differ
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/JCL/jclMin1.8.jar b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/JCL/jclMin1.8.jar
index 6811e28..ab518e9 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/JCL/jclMin1.8.jar
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/JCL/jclMin1.8.jar
Binary files differ
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/JCL/jclMin1.8src.zip b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/JCL/jclMin1.8src.zip
index 06a502f..a5b98c8 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/JCL/jclMin1.8src.zip
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests.refactoring/JCL/jclMin1.8src.zip
Binary files differ
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/JCL/jclMin1.8.jar b/testplugins/org.eclipse.objectteams.otdt.ui.tests/JCL/jclMin1.8.jar
index 6811e28..ab518e9 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/JCL/jclMin1.8.jar
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/JCL/jclMin1.8.jar
Binary files differ
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/JCL/jclMin1.8src.zip b/testplugins/org.eclipse.objectteams.otdt.ui.tests/JCL/jclMin1.8src.zip
index 06a502f..a5b98c8 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/JCL/jclMin1.8src.zip
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/JCL/jclMin1.8src.zip
Binary files differ