diff options
author | Stephan Herrmann | 2012-10-07 12:19:20 +0000 |
---|---|---|
committer | Stephan Herrmann | 2012-10-07 12:19:20 +0000 |
commit | 1f1a67672efebc390717e595625d6d7b6a46ddca (patch) | |
tree | 2123955921f18518bf39efe7d85dd806c9bb1738 /testplugins | |
parent | 89ecdad2393f5918986c1be79e6300429bb03ab5 (diff) | |
download | org.eclipse.objectteams-1f1a67672efebc390717e595625d6d7b6a46ddca.tar.gz org.eclipse.objectteams-1f1a67672efebc390717e595625d6d7b6a46ddca.tar.xz org.eclipse.objectteams-1f1a67672efebc390717e595625d6d7b6a46ddca.zip |
Bug 382188 - NPE in copyRole() when commenting out roles in a nested
team / role file
- immediate: ensure roles found during complete type bindings are
connected, too
- secondary: teams w/o a super team always need reflection methods
(was regression in OTReconcilerTests.testRoFiNestedTeam)
Diffstat (limited to 'testplugins')
-rw-r--r-- | testplugins/org.eclipse.objectteams.otdt.tests/model/org/eclipse/objectteams/otdt/tests/otmodel/OTReconcilerTests.java | 71 |
1 files changed, 70 insertions, 1 deletions
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 6576def14..6d2993c44 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 @@ -30,6 +30,7 @@ import junit.framework.Test; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IncrementalProjectBuilder; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.Platform; @@ -89,7 +90,7 @@ public class OTReconcilerTests extends ReconcilerTests { } static { -// TESTS_NAMES = new String[] { "testPlainJava_SyntaxError" }; +// TESTS_NAMES = new String[] { "testEmptyNestedExternalTeam" }; } // ===== Copied all our modifications from AbstractJavaModelTests ===== /* @@ -1562,4 +1563,72 @@ public class OTReconcilerTests extends ReconcilerTests { } } + // Bug 382188 - NPE in copyRole() when commenting out roles in a nested + public void testEmptyNestedExternalTeam() throws CoreException, InterruptedException { + try { + // Resources creation + IJavaProject p = createOTJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "bin"); + IProject project = p.getProject(); + IProjectDescription prjDesc = project.getDescription(); + prjDesc.setBuildSpec(OTDTPlugin.createProjectBuildCommands(prjDesc)); + project.setDescription(prjDesc, null); + p.setOption(JavaCore.COMPILER_PB_UNUSED_LOCAL, JavaCore.IGNORE); + + OTREContainer.initializeOTJProject(project); + + this.createFolder("/P/p"); + + String superTeamSourceString = + "package p;\n" + + "public team class SuperTeam {\n" + + "}\n"; + this.createFile( + "/P/p/SuperTeam.java", + superTeamSourceString); + + String superMidString = + "team package p.SuperTeam;\n" + + "protected team class Mid {\n" + + " protected class Inner {}\n" + + "}\n"; + this.createFolder( + "/P/p/SuperTeam"); + this.createFile( + "/P/p/SuperTeam/Mid.java", + superMidString); + + String subTeamSourceString = + "package p;\n" + + "public team class SubTeam extends SuperTeam {\n" + + " protected class Mid2 {}\n" + + "}\n"; + this.createFile( + "/P/p/SubTeam.java", + subTeamSourceString); + + this.createFolder( + "/P/p/SubTeam"); + String subMidCompleteSourceString = + "team package p/SubTeam;\n" + + "protected team class Mid {\n" + + " protected class Inner {}\n" + + "}\n"; + this.createFile("/P/p/SubTeam/Mid.java", subMidCompleteSourceString); + + project.build(IncrementalProjectBuilder.FULL_BUILD, null); + + String subMidSourceString = + "team package p.SubTeam;\n" + + "protected team class Mid {\n" + + "}\n"; + + char[] subMidSourceChars = subMidSourceString.toCharArray(); + this.problemRequestor.initialize(subMidSourceChars); + + ICompilationUnit icu = getCompilationUnit("/P/p/SubTeam/Mid.java").getWorkingCopy(this.wcOwner, null); + assertNoProblem(subMidSourceChars, icu); + } finally { + deleteProject("P"); + } + } } |