From 4c3d4d6f69bed5bb16f4ff3effc8675c257a188c Mon Sep 17 00:00:00 2001 From: aclement Date: Fri, 13 Aug 2010 15:44:14 +0000 Subject: [PATCH] 322446, 322664 --- .../systemtest/ajc1610/Ajc1610Tests.java | 3 + .../aspectj/systemtest/ajc1610/ajc1610.xml | 9 ++ .../tools/MultiProjectIncrementalTests.java | 137 ++++++++++++------ 3 files changed, 101 insertions(+), 48 deletions(-) diff --git a/tests/src/org/aspectj/systemtest/ajc1610/Ajc1610Tests.java b/tests/src/org/aspectj/systemtest/ajc1610/Ajc1610Tests.java index 061be391b..9268bde8e 100644 --- a/tests/src/org/aspectj/systemtest/ajc1610/Ajc1610Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc1610/Ajc1610Tests.java @@ -18,6 +18,9 @@ import org.aspectj.testing.XMLBasedAjcTestCase; public class Ajc1610Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + public void testAbstractAspectDeclareParents_322446() { + runTest("declare parents abstract aspect"); + } public void testAbstractAspectAndDeclares_322272_2() { runTest("abstract aspects and declares - 2"); } diff --git a/tests/src/org/aspectj/systemtest/ajc1610/ajc1610.xml b/tests/src/org/aspectj/systemtest/ajc1610/ajc1610.xml index 44b7c0eba..4cdfa2387 100644 --- a/tests/src/org/aspectj/systemtest/ajc1610/ajc1610.xml +++ b/tests/src/org/aspectj/systemtest/ajc1610/ajc1610.xml @@ -2,6 +2,15 @@ + + + + + + + + + diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index 923cb6fc3..8831f8c93 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -1,11 +1,11 @@ /******************************************************************** - * Copyright (c) 2005 Contributors. All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution and is available at - * http://eclipse.org/legal/epl-v10.html - * - * Contributors: + * Copyright (c) 2005 Contributors. All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://eclipse.org/legal/epl-v10.html + * + * Contributors: * Andy Clement initial implementation * Helen Hawkins Converted to new interface (bug 148190) *******************************************************************/ @@ -172,7 +172,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa build(p); printModel(p); IRelationshipMap irm = getModelFor(p).getRelationshipMap(); - List rels = irm.get("=pr284771 rels = irm.get("=pr284771 rels = irm.get("=pr322446<{AbstractAspect.java'AbstractAspect`declare parents"); + assertNotNull(rels); + } + + public void testAspectInheritance_322446_2() throws Exception { + String p ="pr322446_2"; + initialiseProject(p); + build(p); + IProgramElement thisAspectNode = getModelFor(p).getHierarchy().findElementForType("","Sub"); + assertEquals("{Code=[I]}",thisAspectNode.getDeclareParentsMap().toString()); + } + + // found whilst looking at 322446 hence that is the testdata name + public void testAspectInheritance_322664() throws Exception { + AjdeInteractionTestbed.VERBOSE=true; + String p ="pr322446_3"; + initialiseProject(p); + build(p); + assertNoErrors(p); + alter(p,"inc1"); + build(p); + // should be some errors: + // error at N:\temp\ajcSandbox\aspectj16_1\ajcTest3209787521625191676.tmp\pr322446_3\src\AbstractAspect.java:5:0::0 can't bind type name 'T' + // error at N:\temp\ajcSandbox\aspectj16_1\ajcTest3209787521625191676.tmp\pr322446_3\src\AbstractAspect.java:8:0::0 Incorrect number of arguments for type AbstractAspect; it cannot be parameterized with arguments + List errors = getErrorMessages(p); + assertTrue(errors!=null && errors.size()>0); + alter(p,"inc2"); + build(p); + // that build would contain an exception if the bug were around + assertNoErrors(p); + } + // TODO (asc) these tests don't actually verify anything! // public void testAtDeclareParents_280658() throws Exception { // AjdeInteractionTestbed.VERBOSE = true; @@ -220,7 +262,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa build(p); printModel(p); IProgramElement decpPE = getModelFor(p).getHierarchy().findElementForHandle( - "=pr286539"); + .findElementForLabel(top2.getRoot(), IProgramElement.Kind.ADVICE, "before(): "); assertEquals("expected advice to be on line " + pe.getSourceLocation().getLine() + 1 + " but was on " + pe2.getSourceLocation().getLine(), pe.getSourceLocation().getLine() + 1, pe2.getSourceLocation().getLine()); assertEquals("expected advice to have handle " + pe.getHandleIdentifier() + " but found handle " @@ -3395,7 +3436,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa build("PR141556"); checkWasFullBuild(); String warningMessage = "can not build thisJoinPoint " + "lazily for this advice since it has no suitable guard " - + "[Xlint:noGuardForLazyTjp]"; + + "[Xlint:noGuardForLazyTjp]"; assertEquals("warning message should be '" + warningMessage + "'", warningMessage, (getWarningMessages("PR141556").get(0)) .getMessage()); @@ -3469,14 +3510,14 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa public void testPR164384_1() { initialiseProject("PR164384"); - Hashtable javaOptions = new Hashtable(); + Hashtable javaOptions = new Hashtable(); javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6"); javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.6"); javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.6"); configureJavaOptionsMap("PR164384", javaOptions); build("PR164384"); - List errors = getErrorMessages("PR164384"); + List errors = getErrorMessages("PR164384"); if (getCompilerForProjectWithName("PR164384").isJava6Compatible()) { assertTrue("There should be no errors:\n" + errors, errors.isEmpty()); @@ -3501,7 +3542,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa public void testPR164384_2() { initialiseProject("PR164384"); - Hashtable javaOptions = new Hashtable(); + Hashtable javaOptions = new Hashtable(); javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6"); javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.5"); javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.5"); @@ -3531,7 +3572,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa public void testPR164384_3() { initialiseProject("PR164384"); - Hashtable javaOptions = new Hashtable(); + Hashtable javaOptions = new Hashtable(); javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6"); javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.6"); javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.5"); @@ -3564,12 +3605,12 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa // set up the inpath to have the directory on it's path File f = new File(inpathDir); - Set s = new HashSet(); + Set s = new HashSet(); s.add(f); configureInPath("inpathTesting", s); build("inpathTesting"); // the declare warning matches one place so expect one warning message - List warnings = getWarningMessages("inpathTesting"); + List warnings = getWarningMessages("inpathTesting"); assertTrue("Expected there to be one warning message but found " + warnings.size() + ": " + warnings, warnings.size() == 1); // copy over the updated version of the inpath class file @@ -3630,7 +3671,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa // set up the inpath to have the directory on it's path File f = new File(inpathDir); - Set s = new HashSet(); + Set s = new HashSet(); s.add(f); configureInPath(p, s); @@ -3649,7 +3690,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa // This alteration removes B.java, the build should not damage phantom handle based relationships String fileB = getWorkingDir().getAbsolutePath() + File.separatorChar + "inpathHandles" + File.separatorChar + "src" - + File.separatorChar + "p" + File.separatorChar + "B.java"; + + File.separatorChar + "p" + File.separatorChar + "B.java"; (new File(fileB)).delete(); build(p); assertNotNull(getModelFor(p).getRelationshipMap().get("=inpathHandles/, s = new HashSet(); s.add(f); - Map m = new HashMap(); + Map m = new HashMap(); m.put(f, "wibble"); configureOutputLocationManager(p, new TestOutputLocationManager(getProjectRelativePath(p, ".").toString(), m)); @@ -3688,7 +3729,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa pw.flush(); } catch (Exception e) { } - List l = getModelFor(p).getRelationshipMap().get("=inpathHandles/,wibble l = getModelFor(p).getRelationshipMap().get("=inpathHandles/,wibble getRelatedElements(AsmManager model, IProgramElement advice) { + List output = null; IRelationshipMap map = model.getRelationshipMap(); - List/* IRelationship */rels = map.get(advice); + List rels = map.get(advice); if (rels == null) { fail("Did not find any related elements!"); } - for (Iterator iter = rels.iterator(); iter.hasNext();) { - IRelationship element = (IRelationship) iter.next(); - List/* String */targets = element.getTargets(); + for (Iterator iter = rels.iterator(); iter.hasNext();) { + IRelationship element = iter.next(); + List targets = element.getTargets(); if (output == null) { - output = new ArrayList(); + output = new ArrayList(); } output.addAll(targets); } @@ -3837,7 +3878,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa return ipe; } } - List kids = ipe.getChildren(); + List kids = ipe.getChildren(); for (Iterator iter = kids.iterator(); iter.hasNext();) { IProgramElement kid = (IProgramElement) iter.next(); IProgramElement found = findCode(kid, linenumber); -- 2.39.5