diff options
author | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-14 23:00:48 +0200 |
---|---|---|
committer | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-14 23:00:48 +0200 |
commit | 17c4c44c4cd0051b2a0884cd70bdbd9ac3d15b0f (patch) | |
tree | 897e1ed0d6314c4769dcadd1f2fed4e4a54d0377 /ajde.core | |
parent | 05f797adde987f614684cb70999be99c549d6826 (diff) | |
parent | dbbbac8dbd25a19c56568623b823eba4e6e2906a (diff) | |
download | aspectj-17c4c44c4cd0051b2a0884cd70bdbd9ac3d15b0f.tar.gz aspectj-17c4c44c4cd0051b2a0884cd70bdbd9ac3d15b0f.zip |
Merge branch 'master' of github.com:eclipse/org.aspectj into remove-old-version-checks
Diffstat (limited to 'ajde.core')
7 files changed, 119 insertions, 118 deletions
diff --git a/ajde.core/src/main/java/org/aspectj/ajde/core/internal/AjdeCoreBuildManager.java b/ajde.core/src/main/java/org/aspectj/ajde/core/internal/AjdeCoreBuildManager.java index 6547d101c..49948db46 100644 --- a/ajde.core/src/main/java/org/aspectj/ajde/core/internal/AjdeCoreBuildManager.java +++ b/ajde.core/src/main/java/org/aspectj/ajde/core/internal/AjdeCoreBuildManager.java @@ -1,11 +1,11 @@ /******************************************************************** - * Copyright (c) 2007 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: IBM Corporation - initial API and implementation + * Copyright (c) 2007 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: IBM Corporation - initial API and implementation * Helen Hawkins - initial version (bug 148190) *******************************************************************/ package org.aspectj.ajde.core.internal; @@ -13,7 +13,6 @@ package org.aspectj.ajde.core.internal; import java.io.File; import java.util.ArrayList; import java.util.Collection; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.StringTokenizer; @@ -70,7 +69,7 @@ public class AjdeCoreBuildManager { /** * Execute a full or incremental build - * + * * @param fullBuild true if requesting a full build, false if requesting to try an incremental build */ public void performBuild(boolean fullBuild) { @@ -160,12 +159,12 @@ public class AjdeCoreBuildManager { private String getFormattedOptionsString() { ICompilerConfiguration compilerConfig = compiler.getCompilerConfiguration(); return "Building with settings: " + "\n-> output paths: " - + formatCollection(compilerConfig.getOutputLocationManager().getAllOutputLocations()) + "\n-> classpath: " - + compilerConfig.getClasspath() + "\n-> -inpath " + formatCollection(compilerConfig.getInpath()) + "\n-> -outjar " - + formatOptionalString(compilerConfig.getOutJar()) + "\n-> -aspectpath " - + formatCollection(compilerConfig.getAspectPath()) + "\n-> -sourcePathResources " - + formatMap(compilerConfig.getSourcePathResources()) + "\n-> non-standard options: " - + compilerConfig.getNonStandardOptions() + "\n-> javaoptions:" + formatMap(compilerConfig.getJavaOptionsMap()); + + formatCollection(compilerConfig.getOutputLocationManager().getAllOutputLocations()) + "\n-> classpath: " + + compilerConfig.getClasspath() + "\n-> -inpath " + formatCollection(compilerConfig.getInpath()) + "\n-> -outjar " + + formatOptionalString(compilerConfig.getOutJar()) + "\n-> -aspectpath " + + formatCollection(compilerConfig.getAspectPath()) + "\n-> -sourcePathResources " + + formatMap(compilerConfig.getSourcePathResources()) + "\n-> non-standard options: " + + compilerConfig.getNonStandardOptions() + "\n-> javaoptions:" + formatMap(compilerConfig.getJavaOptionsMap()); } private String formatCollection(Collection<?> options) { @@ -209,7 +208,7 @@ public class AjdeCoreBuildManager { /** * Generate a new AjBuildConfig from the compiler configuration associated with this AjdeCoreBuildManager or from a * configuration file. - * + * * @return null if invalid configuration, corresponding AjBuildConfig otherwise */ public AjBuildConfig generateAjBuildConfig() { diff --git a/ajde.core/src/test/java/org/aspectj/ajde/core/TestBuildProgressMonitor.java b/ajde.core/src/test/java/org/aspectj/ajde/core/TestBuildProgressMonitor.java index f732d2acb..5269a586a 100644 --- a/ajde.core/src/test/java/org/aspectj/ajde/core/TestBuildProgressMonitor.java +++ b/ajde.core/src/test/java/org/aspectj/ajde/core/TestBuildProgressMonitor.java @@ -1,11 +1,11 @@ /******************************************************************** - * Copyright (c) 2007 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: IBM Corporation - initial API and implementation + * Copyright (c) 2007 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: IBM Corporation - initial API and implementation * Helen Hawkins - initial version *******************************************************************/ package org.aspectj.ajde.core; @@ -19,19 +19,20 @@ import java.util.List; * after a specified string has been printed. */ public class TestBuildProgressMonitor implements IBuildProgressMonitor { - + + private static boolean verbose = System.getProperty("aspectj.tests.verbose","false").equalsIgnoreCase("true"); private static boolean debugTests = false; - + public int numWovenClassMessages = 0; - public int numWovenAspectMessages = 0; - public int numCompiledMessages = 0; - + public int numWovenAspectMessages = 0; + public int numCompiledMessages = 0; + private String programmableString; private int count; private List<String> messagesReceived = new ArrayList<>(); private int currentVal; private boolean isCancelRequested = false; - + public void finish(boolean wasFullBuild) { System.out.println("build finished. Was full build: " + wasFullBuild); } @@ -45,14 +46,16 @@ public class TestBuildProgressMonitor implements IBuildProgressMonitor { } public void setProgressText(String text) { - System.out.println("progress text: " + text); + if (verbose) { + System.out.println("progress text: " + text); + } String newText = text+" [Percentage="+currentVal+"%]"; messagesReceived.add(newText); if (text.startsWith("woven aspect ")) numWovenAspectMessages++; if (text.startsWith("woven class ")) numWovenClassMessages++; if (text.startsWith("compiled:")) numCompiledMessages++; if (programmableString != null - && text.contains(programmableString)) { + && text.contains(programmableString)) { count--; if (count==0) { if (debugTests) System.out.println("Just got message '"+newText+"' - asking build to cancel"); @@ -63,7 +66,9 @@ public class TestBuildProgressMonitor implements IBuildProgressMonitor { } public void begin() { - System.out.println("build started"); + if (verbose) { + System.out.println("build started"); + } currentVal = 0; } @@ -72,7 +77,7 @@ public class TestBuildProgressMonitor implements IBuildProgressMonitor { programmableString = string; this.count = count; } - + public boolean containsMessage(String prefix,String distinguishingMarks) { for (String element: messagesReceived) { if (element.startsWith(prefix) && @@ -80,12 +85,14 @@ public class TestBuildProgressMonitor implements IBuildProgressMonitor { } return false; } - + public void dumpMessages() { - System.out.println("ProgressMonitorMessages"); + if (verbose) { + System.out.println("ProgressMonitorMessages"); + } for (String element: messagesReceived) { System.out.println(element); } } - + } diff --git a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/OutxmlTest.java b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/OutxmlTest.java index 6434629bf..64417e84c 100644 --- a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/OutxmlTest.java +++ b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/OutxmlTest.java @@ -1,11 +1,11 @@ /******************************************************************** - * Copyright (c) 2003 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://www.eclipse.org/legal/epl-v10.html - * - * Contributors: + * Copyright (c) 2003 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://www.eclipse.org/legal/epl-v10.html + * + * Contributors: * Matthew Webster initial implementation * Helen Hawkins Converted to new interface (bug 148190) *******************************************************************/ @@ -29,9 +29,9 @@ public class OutxmlTest extends AjdeCoreTestCase { public static final String PROJECT_DIR = "OutxmlTest"; public static final String BIN_DIR = "bin"; - public static final String OUTJAR_NAME = "/bin/test.jar"; - public static final String DEFAULT_AOPXML_NAME = Constants.AOP_AJC_XML; - public static final String CUSTOM_AOPXML_NAME = "custom/aop.xml"; + public static final String OUTJAR_NAME = "/bin/test.jar"; + public static final String DEFAULT_AOPXML_NAME = Constants.AOP_AJC_XML; + public static final String CUSTOM_AOPXML_NAME = "custom/aop.xml"; private String[] files = new String[]{ "src" + File.separator + "TestAbstractAspect.aj", @@ -39,7 +39,7 @@ public class OutxmlTest extends AjdeCoreTestCase { "src" + File.separator + "TestConcreteAspect.aj", "src" + File.separator + "TestInterface.java" }; - + private TestMessageHandler handler; private TestCompilerConfiguration compilerConfig; @@ -56,7 +56,7 @@ public class OutxmlTest extends AjdeCoreTestCase { handler = null; compilerConfig = null; } - + /** * Aim: Test "-outxml" option produces the correct xml file */ @@ -65,31 +65,31 @@ public class OutxmlTest extends AjdeCoreTestCase { compilerConfig.setNonStandardOptions("-outxml"); doBuild(true); assertTrue("Expected no compiler errors or warnings but found " - + handler.getMessages(), handler.getMessages().isEmpty()); + + handler.getMessages(), handler.getMessages().isEmpty()); File aopxml = openFile(BIN_DIR + "/" + DEFAULT_AOPXML_NAME); assertTrue(DEFAULT_AOPXML_NAME + " missing",aopxml.exists()); } - + /** - * Aim: Test "-outxmlfile filename" option produces the correct + * Aim: Test "-outxmlfile filename" option produces the correct * xml file - * + * */ public void testOutxmlfileToFile () { compilerConfig.setProjectSourceFiles(getSourceFileList(files)); compilerConfig.setNonStandardOptions("-outxmlfile custom/aop.xml"); doBuild(true); assertTrue("Expected no compiler errors or warnings but found " - + handler.getMessages(), handler.getMessages().isEmpty()); - + + handler.getMessages(), handler.getMessages().isEmpty()); + File aopxml = openFile(BIN_DIR + "/" + CUSTOM_AOPXML_NAME); assertTrue(CUSTOM_AOPXML_NAME + " missing",aopxml.exists()); } /** - * Aim: Test "-outxml" option produces the correct + * Aim: Test "-outxml" option produces the correct * xml entry in outjar file - * + * */ public void testOutxmlToOutjar () { File outjar = openFile(OUTJAR_NAME); @@ -98,44 +98,44 @@ public class OutxmlTest extends AjdeCoreTestCase { compilerConfig.setNonStandardOptions("-outxml"); doBuild(true); assertTrue("Expected no compiler errors or warnings but found " - + handler.getMessages(), handler.getMessages().isEmpty()); - + + handler.getMessages(), handler.getMessages().isEmpty()); + File aopxml = openFile(BIN_DIR + "/" + DEFAULT_AOPXML_NAME); assertFalse(DEFAULT_AOPXML_NAME + " should not exisit",aopxml.exists()); assertJarContainsEntry(outjar,DEFAULT_AOPXML_NAME); } /** - * Aim: Test "-outxml" option produces a warning if "META-INF/aop.xml + * Aim: Test "-outxml" option produces a warning if "META-INF/aop.xml * already exists in source - * + * */ public void testOutxmlToOutjarWithAop_xml () { File f = new File( getAbsoluteProjectDir() + File.separator + "src-resources" + File.separator + "testjar.jar"); Set<File> roots = new HashSet<>(); roots.add(f); compilerConfig.setInpath(roots); - + File outjar = openFile(OUTJAR_NAME); compilerConfig.setOutjar(outjar.getAbsolutePath()); compilerConfig.setNonStandardOptions("-outxml"); doBuild(true); assertFalse("Expected compiler errors or warnings but didn't find any " + handler.getMessages(), handler.getMessages().isEmpty()); - + List<TestMessage> msgs = handler.getMessages(); - String msg = ((TestMessageHandler.TestMessage)msgs.get(0)).getContainedMessage().getMessage(); + String msg = msgs.get(0).getContainedMessage().getMessage(); String exp = "-outxml/-outxmlfile option ignored because resource already exists:"; assertTrue("Expected message to start with : " + exp + " but found message " + msg,msg.startsWith(exp)); - + File aopxml = openFile(BIN_DIR + "/" + DEFAULT_AOPXML_NAME); assertFalse(DEFAULT_AOPXML_NAME + " should not exisit",aopxml.exists()); assertJarContainsEntry(outjar,DEFAULT_AOPXML_NAME); } - + /** - * Aim: Test "-outxmlfile filename" option produces the correct + * Aim: Test "-outxmlfile filename" option produces the correct * xml entry in outjar file */ public void testOutxmlfileToOutjar () { @@ -145,17 +145,15 @@ public class OutxmlTest extends AjdeCoreTestCase { compilerConfig.setNonStandardOptions("-outxmlfile custom/aop.xml"); doBuild(true); assertTrue("Expected no compiler errors or warnings but found " - + handler.getMessages(), handler.getMessages().isEmpty()); - + + handler.getMessages(), handler.getMessages().isEmpty()); + File aopxml = openFile(BIN_DIR + "/" + CUSTOM_AOPXML_NAME); assertFalse(CUSTOM_AOPXML_NAME + " should not exisit",aopxml.exists()); assertJarContainsEntry(outjar,CUSTOM_AOPXML_NAME); } private void assertJarContainsEntry (File file, String entryName) { - - try { - JarFile jarFile = new JarFile(file); + try (JarFile jarFile = new JarFile(file)) { JarEntry jarEntry = jarFile.getJarEntry(entryName); assertNotNull(entryName + " missing",jarEntry); } diff --git a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/ShowWeaveMessagesTest.java b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/ShowWeaveMessagesTest.java index 3bd3fbdb6..c5fa43e16 100644 --- a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/ShowWeaveMessagesTest.java +++ b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/ShowWeaveMessagesTest.java @@ -1,12 +1,12 @@ /* ******************************************************************* * Copyright (c) 2004 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://www.eclipse.org/legal/epl-v10.html - * - * 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://www.eclipse.org/legal/epl-v10.html + * + * Contributors: * Andy Clement Initial version * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ @@ -19,7 +19,6 @@ import java.io.FileWriter; import java.util.ArrayList; import java.util.HashSet; import java.util.Hashtable; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -35,24 +34,24 @@ import org.aspectj.util.LangUtil; * Weaving messages are complicated things. There are multiple places where weaving takes place and the places vary depending on * whether we are doing a binary weave or going from source. All places that output weaving messages are tagged: // TAG: * WeavingMessage so you can easily find them! - * + * * Advice is the simplest to deal with as that is advice weaving is always done in the weaver. - * + * * Next is intertype declarations. These are also always done in the weaver but in the case of a binary weave we don't know the * originating source line for the ITD. - * + * * Finally, declares. Declare Parents: extends Can only be done when going from source, if attempted by a binary weave then an error * message (compiler limitation) is produced. Declare Parents: implements Is (currently!) done at both compile time and weave time. * If going from source then the message is produced by the code in the compiler. if going from binary then the message is produced * by the weaver. Declare Soft: Comes out with 'advice' as a special kind of advice: softener advice - * - * + * + * * Q: Where are the messages turned on/off? A: It is a bit messy. See BuildArgParser.genBuildConfig(). Basically that method is the * first time we parse the option set. Whether weaving messages are on or off is stored in the build config. As soon as we have * parser the options and determined that weave messages are on, we grab the top level message handler and tell it not to ignore * WeaveInfo messages. - * - * + * + * * TODO - Other forms of declare? Do they need messages? e.g. declare precedence * */ public class ShowWeaveMessagesTest extends AjdeCoreTestCase { diff --git a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/model/AsmDeclarationsTest.java b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/model/AsmDeclarationsTest.java index 7a2ec9fc5..6112e67a3 100644 --- a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/model/AsmDeclarationsTest.java +++ b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/model/AsmDeclarationsTest.java @@ -1,11 +1,11 @@ /* ******************************************************************* * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC). - * 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://www.eclipse.org/legal/epl-v10.html - * + * 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://www.eclipse.org/legal/epl-v10.html + * * ******************************************************************/ package org.aspectj.ajde.core.tests.model; @@ -19,7 +19,7 @@ import org.aspectj.asm.IProgramElement; public class AsmDeclarationsTest extends AjdeCoreTestCase { - private AsmManager manager = null; + // private AsmManager manager = null; private IHierarchy model = null; private final String[] files = new String[] { "ModelCoverage.java", "pkg" + File.separator + "InPackage.java" }; @@ -33,7 +33,7 @@ public class AsmDeclarationsTest extends AjdeCoreTestCase { compilerConfig.setProjectSourceFiles(getSourceFileList(files)); compilerConfig.setNonStandardOptions("-Xset:minimalModel=false"); doBuild(); - manager = AsmManager.lastActiveStructureModel; + // manager = AsmManager.lastActiveStructureModel; model = AsmManager.lastActiveStructureModel.getHierarchy(); } @@ -72,10 +72,10 @@ public class AsmDeclarationsTest extends AjdeCoreTestCase { public void testFileInPackageAndDefaultPackage() { IProgramElement root = model.getRoot(); assertEquals(root.toLabelString(), "coverage"); - IProgramElement pkg = (IProgramElement) root.getChildren().get(1); + IProgramElement pkg = root.getChildren().get(1); assertEquals(pkg.toLabelString(), "pkg"); - assertEquals(((IProgramElement) pkg.getChildren().get(0)).toLabelString(), "InPackage.java"); - assertEquals(((IProgramElement) ((IProgramElement) root.getChildren().get(0)).getChildren().get(0)).toLabelString(), + assertEquals(pkg.getChildren().get(0).toLabelString(), "InPackage.java"); + assertEquals(root.getChildren().get(0).getChildren().get(0).toLabelString(), "ModelCoverage.java"); } @@ -105,9 +105,9 @@ public class AsmDeclarationsTest extends AjdeCoreTestCase { // check the next two relative to this one int declareIndex = decParentsNode.getParent().getChildren().indexOf(decParentsNode); String decParentsPtnMessage = "declare parents: extends Observable"; - assertEquals(decParentsPtnMessage, ((IProgramElement) aspect.getChildren().get(declareIndex + 1)).toLabelString()); + assertEquals(decParentsPtnMessage, aspect.getChildren().get(declareIndex + 1).toLabelString()); String decParentsTPMessage = "declare parents: extends Observable"; - assertEquals(decParentsTPMessage, ((IProgramElement) aspect.getChildren().get(declareIndex + 2)).toLabelString()); + assertEquals(decParentsTPMessage, aspect.getChildren().get(declareIndex + 2).toLabelString()); String decSoftMessage = "declare soft: SizeException"; IProgramElement decSoftNode = model.findElementForSignature(aspect, IProgramElement.Kind.DECLARE_SOFT, "declare soft"); diff --git a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/model/AsmRelationshipsTest.java b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/model/AsmRelationshipsTest.java index 4feefedcb..093de8cb7 100644 --- a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/model/AsmRelationshipsTest.java +++ b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/model/AsmRelationshipsTest.java @@ -1,17 +1,16 @@ /* ******************************************************************* * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC). - * 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://www.eclipse.org/legal/epl-v10.html - * + * 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://www.eclipse.org/legal/epl-v10.html + * * ******************************************************************/ package org.aspectj.ajde.core.tests.model; import java.io.File; -import java.util.Iterator; import java.util.List; import org.aspectj.ajde.core.AjdeCoreTestCase; diff --git a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/model/StructureModelTest.java b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/model/StructureModelTest.java index 739daee32..6f06a1aa0 100644 --- a/ajde.core/src/test/java/org/aspectj/ajde/core/tests/model/StructureModelTest.java +++ b/ajde.core/src/test/java/org/aspectj/ajde/core/tests/model/StructureModelTest.java @@ -1,13 +1,13 @@ /* ******************************************************************* * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC). - * 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://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Xerox/PARC initial implementation + * 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://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Xerox/PARC initial implementation * AMC 21.01.2003 fixed for new source location in eclipse.org * Helen Hawkins Converted to new interface (bug 148190) * ******************************************************************/ @@ -15,7 +15,6 @@ package org.aspectj.ajde.core.tests.model; import java.io.File; import java.io.IOException; -import java.util.Iterator; import org.aspectj.ajde.core.AjdeCoreTestCase; import org.aspectj.ajde.core.TestCompilerConfiguration; @@ -57,7 +56,7 @@ public class StructureModelTest extends AjdeCoreTestCase { File testFile = openFile("figures" + File.separator + "Figure.java"); IProgramElement node = manager.getHierarchy().findElementForSourceFile(testFile.getAbsolutePath()); assertTrue("find result", node != null); - String child = ((IProgramElement) node.getChildren().get(2)).getName(); + String child = node.getChildren().get(2).getName(); assertTrue("expected Figure got child " + child, child.equals("Figure")); } @@ -65,9 +64,9 @@ public class StructureModelTest extends AjdeCoreTestCase { File testFile = openFile("figures" + File.separator + "Main.java"); IProgramElement node = manager.getHierarchy().findElementForSourceFile(testFile.getAbsolutePath()); assertTrue("find result", node != null); - IProgramElement pNode = (IProgramElement) (node).getChildren().get(3); + IProgramElement pNode = (node).getChildren().get(3); assertEquals(IProgramElement.Kind.ASPECT, pNode.getKind()); - IProgramElement pointcut = (IProgramElement) pNode.getChildren().get(0); + IProgramElement pointcut = pNode.getChildren().get(0); assertTrue("kind", pointcut.getKind().equals(IProgramElement.Kind.POINTCUT)); assertTrue("found node: " + pointcut.getName(), pointcut.toLabelString().equals("testptct()")); } |