issue_id
int64
2.04k
425k
title
stringlengths
9
251
body
stringlengths
4
32.8k
status
stringclasses
6 values
after_fix_sha
stringlengths
7
7
project_name
stringclasses
6 values
repo_url
stringclasses
6 values
repo_name
stringclasses
6 values
language
stringclasses
1 value
issue_url
null
before_fix_sha
null
pull_url
null
commit_datetime
timestamp[us, tz=UTC]
report_datetime
timestamp[us, tz=UTC]
updated_file
stringlengths
23
187
chunk_content
stringlengths
1
22k
298,786
Bug 298786 suspected problem with handling of multiple aop.xml files
null
resolved fixed
a968890
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-01-05T00:44:36Z
2010-01-04T18:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
*/ public String getNamespace() { if (namespace == null) { return ""; } else { return new String(namespace); } } /** * Check to see if any classes are stored in the generated classes cache. Then flush the cache if it is not empty * * @param className TODO * @return true if a class has been generated and is stored in the cache */ public boolean generatedClassesExistFor(String className) { if (className == null) { return !generatedClasses.isEmpty(); } else { return generatedClasses.containsKey(className); } } /** * Flush the generated classes cache */ public void flushGeneratedClasses() {
298,786
Bug 298786 suspected problem with handling of multiple aop.xml files
null
resolved fixed
a968890
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-01-05T00:44:36Z
2010-01-04T18:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
generatedClasses = new HashMap(); } private void defineClass(ClassLoader loader, String name, byte[] bytes) { if (trace.isTraceEnabled()) { trace.enter("defineClass", this, new Object[] { loader, name, bytes }); } Object clazz = null; debug("generating class '" + name + "'"); try { Method defineClass = ClassLoader.class.getDeclaredMethod("defineClass", new Class[] { String.class, bytes.getClass(), int.class, int.class }); defineClass.setAccessible(true); clazz = defineClass.invoke(loader, new Object[] { name, bytes, new Integer(0), new Integer(bytes.length) }); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof LinkageError) { warn("define generated class failed", e.getTargetException()); } else { warn("define generated class failed", e.getTargetException()); } } catch (Exception e) { warn("define generated class failed", e); } if (trace.isTraceEnabled()) { trace.exit("defineClass", clazz); } } }
305,788
Bug 305788 Exception was thrown when I saved a file in Eclipse
Build Identifier: SpringSource STS 2.3.1 java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$KeyIterator.next(HashMap.java:828) at org.aspectj.asm.internal.AspectJElementHierarchy.updateHandleMap(AspectJElementHierarchy.java:594) at org.aspectj.asm.AsmManager.removeStructureModelForFiles(AsmManager.java:564) at org.aspectj.asm.AsmManager.processDelta(AsmManager.java:639) at org.aspectj.ajdt.internal.core ... un(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: ConcurrentModificationException thrown: null Reproducible: Always Steps to Reproduce: 1.Generate an abstract class using Spring roo 2. Edit that file within Eclipse/STS to add JPA annotations 3.Click on the save icon to save the file - Exceptions box pops up
resolved fixed
749078d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-03-23T14:26:02Z
2010-03-14T01:26:40Z
asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
/* ******************************************************************* * 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: * Mik Kersten initial implementation * Andy Clement Extensions for better IDE representation
305,788
Bug 305788 Exception was thrown when I saved a file in Eclipse
Build Identifier: SpringSource STS 2.3.1 java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$KeyIterator.next(HashMap.java:828) at org.aspectj.asm.internal.AspectJElementHierarchy.updateHandleMap(AspectJElementHierarchy.java:594) at org.aspectj.asm.AsmManager.removeStructureModelForFiles(AsmManager.java:564) at org.aspectj.asm.AsmManager.processDelta(AsmManager.java:639) at org.aspectj.ajdt.internal.core ... un(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: ConcurrentModificationException thrown: null Reproducible: Always Steps to Reproduce: 1.Generate an abstract class using Spring roo 2. Edit that file within Eclipse/STS to add JPA annotations 3.Click on the save icon to save the file - Exceptions box pops up
resolved fixed
749078d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-03-23T14:26:02Z
2010-03-14T01:26:40Z
asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
* ******************************************************************/ package org.aspectj.asm.internal; import java.io.File; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import org.aspectj.asm.AsmManager; import org.aspectj.asm.IHierarchy; import org.aspectj.asm.IProgramElement; import org.aspectj.bridge.ISourceLocation; import org.aspectj.bridge.SourceLocation; /** * @author Mik Kersten */ public class AspectJElementHierarchy implements IHierarchy { private static final long serialVersionUID = 6462734311117048620L; private transient AsmManager asm; protected IProgramElement root = null; protected String configFile = null; private Map fileMap = null; private Map handleMap = new HashMap(); private Map typeMap = null; public AspectJElementHierarchy(AsmManager asm) { this.asm = asm; }
305,788
Bug 305788 Exception was thrown when I saved a file in Eclipse
Build Identifier: SpringSource STS 2.3.1 java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$KeyIterator.next(HashMap.java:828) at org.aspectj.asm.internal.AspectJElementHierarchy.updateHandleMap(AspectJElementHierarchy.java:594) at org.aspectj.asm.AsmManager.removeStructureModelForFiles(AsmManager.java:564) at org.aspectj.asm.AsmManager.processDelta(AsmManager.java:639) at org.aspectj.ajdt.internal.core ... un(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: ConcurrentModificationException thrown: null Reproducible: Always Steps to Reproduce: 1.Generate an abstract class using Spring roo 2. Edit that file within Eclipse/STS to add JPA annotations 3.Click on the save icon to save the file - Exceptions box pops up
resolved fixed
749078d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-03-23T14:26:02Z
2010-03-14T01:26:40Z
asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
public IProgramElement getElement(String handle) { return findElementForHandleOrCreate(handle, false); } public void setAsmManager(AsmManager asm) { this.asm = asm; } public IProgramElement getRoot() { return root; } public void setRoot(IProgramElement root) { this.root = root; handleMap = new HashMap(); typeMap = new HashMap(); } public void addToFileMap(Object key, Object value) { fileMap.put(key, value); } public boolean removeFromFileMap(Object key) { if (fileMap.containsKey(key)) { return (fileMap.remove(key) != null); } return true; } public void setFileMap(HashMap fileMap) { this.fileMap = fileMap; } public Object findInFileMap(Object key) { return fileMap.get(key); } public Set getFileMapEntrySet() {
305,788
Bug 305788 Exception was thrown when I saved a file in Eclipse
Build Identifier: SpringSource STS 2.3.1 java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$KeyIterator.next(HashMap.java:828) at org.aspectj.asm.internal.AspectJElementHierarchy.updateHandleMap(AspectJElementHierarchy.java:594) at org.aspectj.asm.AsmManager.removeStructureModelForFiles(AsmManager.java:564) at org.aspectj.asm.AsmManager.processDelta(AsmManager.java:639) at org.aspectj.ajdt.internal.core ... un(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: ConcurrentModificationException thrown: null Reproducible: Always Steps to Reproduce: 1.Generate an abstract class using Spring roo 2. Edit that file within Eclipse/STS to add JPA annotations 3.Click on the save icon to save the file - Exceptions box pops up
resolved fixed
749078d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-03-23T14:26:02Z
2010-03-14T01:26:40Z
asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
return fileMap.entrySet(); } public boolean isValid() { return root != null && fileMap != null; } /** * Returns the first match * * @param parent * @param kind not null * @return null if not found */ public IProgramElement findElementForSignature(IProgramElement parent, IProgramElement.Kind kind, String signature) { for (Iterator it = parent.getChildren().iterator(); it.hasNext();) { IProgramElement node = (IProgramElement) it.next(); if (node.getKind() == kind && signature.equals(node.toSignatureString())) { return node; } else { IProgramElement childSearch = findElementForSignature(node, kind, signature); if (childSearch != null) return childSearch; } } return null; } public IProgramElement findElementForLabel(IProgramElement parent, IProgramElement.Kind kind, String label) { for (Iterator it = parent.getChildren().iterator(); it.hasNext();) { IProgramElement node = (IProgramElement) it.next(); if (node.getKind() == kind && label.equals(node.toLabelString())) { return node;
305,788
Bug 305788 Exception was thrown when I saved a file in Eclipse
Build Identifier: SpringSource STS 2.3.1 java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$KeyIterator.next(HashMap.java:828) at org.aspectj.asm.internal.AspectJElementHierarchy.updateHandleMap(AspectJElementHierarchy.java:594) at org.aspectj.asm.AsmManager.removeStructureModelForFiles(AsmManager.java:564) at org.aspectj.asm.AsmManager.processDelta(AsmManager.java:639) at org.aspectj.ajdt.internal.core ... un(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: ConcurrentModificationException thrown: null Reproducible: Always Steps to Reproduce: 1.Generate an abstract class using Spring roo 2. Edit that file within Eclipse/STS to add JPA annotations 3.Click on the save icon to save the file - Exceptions box pops up
resolved fixed
749078d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-03-23T14:26:02Z
2010-03-14T01:26:40Z
asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
} else { IProgramElement childSearch = findElementForLabel(node, kind, label); if (childSearch != null) return childSearch; } } return null; } /** * Find the entry in the model that represents a particular type. * * @param packageName the package in which the type is declared or null for the default package * @param typeName the name of the type * @return the IProgramElement representing the type, or null if not found */ public IProgramElement findElementForType(String packageName, String typeName) { StringBuffer keyb = (packageName == null) ? new StringBuffer() : new StringBuffer(packageName); keyb.append(".").append(typeName); String key = keyb.toString(); IProgramElement cachedValue = (IProgramElement) typeMap.get(key); if (cachedValue != null) { return cachedValue; } List packageNodes = findMatchingPackages(packageName); for (Iterator iterator = packageNodes.iterator(); iterator.hasNext();) { IProgramElement pkg = (IProgramElement) iterator.next(); for (Iterator it = pkg.getChildren().iterator(); it.hasNext();) { IProgramElement fileNode = (IProgramElement) it.next();
305,788
Bug 305788 Exception was thrown when I saved a file in Eclipse
Build Identifier: SpringSource STS 2.3.1 java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$KeyIterator.next(HashMap.java:828) at org.aspectj.asm.internal.AspectJElementHierarchy.updateHandleMap(AspectJElementHierarchy.java:594) at org.aspectj.asm.AsmManager.removeStructureModelForFiles(AsmManager.java:564) at org.aspectj.asm.AsmManager.processDelta(AsmManager.java:639) at org.aspectj.ajdt.internal.core ... un(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: ConcurrentModificationException thrown: null Reproducible: Always Steps to Reproduce: 1.Generate an abstract class using Spring roo 2. Edit that file within Eclipse/STS to add JPA annotations 3.Click on the save icon to save the file - Exceptions box pops up
resolved fixed
749078d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-03-23T14:26:02Z
2010-03-14T01:26:40Z
asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
IProgramElement cNode = findClassInNodes(fileNode.getChildren(), typeName, typeName); if (cNode != null) { typeMap.put(key, cNode); return cNode; } } } return null;
305,788
Bug 305788 Exception was thrown when I saved a file in Eclipse
Build Identifier: SpringSource STS 2.3.1 java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$KeyIterator.next(HashMap.java:828) at org.aspectj.asm.internal.AspectJElementHierarchy.updateHandleMap(AspectJElementHierarchy.java:594) at org.aspectj.asm.AsmManager.removeStructureModelForFiles(AsmManager.java:564) at org.aspectj.asm.AsmManager.processDelta(AsmManager.java:639) at org.aspectj.ajdt.internal.core ... un(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: ConcurrentModificationException thrown: null Reproducible: Always Steps to Reproduce: 1.Generate an abstract class using Spring roo 2. Edit that file within Eclipse/STS to add JPA annotations 3.Click on the save icon to save the file - Exceptions box pops up
resolved fixed
749078d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-03-23T14:26:02Z
2010-03-14T01:26:40Z
asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
} /** * Look for any package nodes matching the specified package name. There may be multiple in the case where the types within a * package are split across source folders. * * @param packagename the packagename being searched for * @return a list of package nodes that match that name */ public ListfindMatchingPackages(String packagename) { List children = root.getChildren(); if (children.size() == 0) { return Collections.EMPTY_LIST; } if (((IProgramElement) children.get(0)).getKind() == IProgramElement.Kind.SOURCE_FOLDER) { String searchPackageName = (packagename == null ? "" : packagename); List matchingPackageNodes = new ArrayList(); for (Iterator iterator = children.iterator(); iterator.hasNext();) { IProgramElement sourceFolder = (IProgramElement) iterator.next(); List possiblePackageNodes = sourceFolder.getChildren(); for (Iterator iterator2 = possiblePackageNodes.iterator(); iterator2.hasNext();) {
305,788
Bug 305788 Exception was thrown when I saved a file in Eclipse
Build Identifier: SpringSource STS 2.3.1 java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$KeyIterator.next(HashMap.java:828) at org.aspectj.asm.internal.AspectJElementHierarchy.updateHandleMap(AspectJElementHierarchy.java:594) at org.aspectj.asm.AsmManager.removeStructureModelForFiles(AsmManager.java:564) at org.aspectj.asm.AsmManager.processDelta(AsmManager.java:639) at org.aspectj.ajdt.internal.core ... un(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: ConcurrentModificationException thrown: null Reproducible: Always Steps to Reproduce: 1.Generate an abstract class using Spring roo 2. Edit that file within Eclipse/STS to add JPA annotations 3.Click on the save icon to save the file - Exceptions box pops up
resolved fixed
749078d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-03-23T14:26:02Z
2010-03-14T01:26:40Z
asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
IProgramElement possiblePackageNode = (IProgramElement) iterator2.next(); if (possiblePackageNode.getKind() == IProgramElement.Kind.PACKAGE) { if (possiblePackageNode.getName().equals(searchPackageName)) { matchingPackageNodes.add(possiblePackageNode); } } } } return matchingPackageNodes; } else { if (packagename == null) { List result = new ArrayList(); result.add(root); return result; } List result = new ArrayList(); for (Iterator iterator = children.iterator(); iterator.hasNext();) { IProgramElement possiblePackage = (IProgramElement) iterator.next(); if (possiblePackage.getKind() == IProgramElement.Kind.PACKAGE && possiblePackage.getName().equals(packagename)) { result.add(possiblePackage); } if (possiblePackage.getKind() == IProgramElement.Kind.SOURCE_FOLDER) { if (possiblePackage.getName().equals("binaries")) { for (Iterator iter2 = possiblePackage.getChildren().iterator(); iter2.hasNext();) { IProgramElement possiblePackage2 = (IProgramElement) iter2.next(); if (possiblePackage2.getKind() == IProgramElement.Kind.PACKAGE
305,788
Bug 305788 Exception was thrown when I saved a file in Eclipse
Build Identifier: SpringSource STS 2.3.1 java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$KeyIterator.next(HashMap.java:828) at org.aspectj.asm.internal.AspectJElementHierarchy.updateHandleMap(AspectJElementHierarchy.java:594) at org.aspectj.asm.AsmManager.removeStructureModelForFiles(AsmManager.java:564) at org.aspectj.asm.AsmManager.processDelta(AsmManager.java:639) at org.aspectj.ajdt.internal.core ... un(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: ConcurrentModificationException thrown: null Reproducible: Always Steps to Reproduce: 1.Generate an abstract class using Spring roo 2. Edit that file within Eclipse/STS to add JPA annotations 3.Click on the save icon to save the file - Exceptions box pops up
resolved fixed
749078d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-03-23T14:26:02Z
2010-03-14T01:26:40Z
asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
&& possiblePackage2.getName().equals(packagename)) { result.add(possiblePackage2); break; } } } } } if (result.isEmpty()) { return Collections.EMPTY_LIST; } else { return result; } } } private IProgramElement findClassInNodes(Collection nodes, String name, String typeName) { String baseName; String innerName; int dollar = name.indexOf('$'); if (dollar == -1) { baseName = name; innerName = null; } else { baseName = name.substring(0, dollar); innerName = name.substring(dollar + 1); } for (Iterator j = nodes.iterator(); j.hasNext();) { IProgramElement classNode = (IProgramElement) j.next(); if (baseName.equals(classNode.getName())) { if (innerName == null)
305,788
Bug 305788 Exception was thrown when I saved a file in Eclipse
Build Identifier: SpringSource STS 2.3.1 java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$KeyIterator.next(HashMap.java:828) at org.aspectj.asm.internal.AspectJElementHierarchy.updateHandleMap(AspectJElementHierarchy.java:594) at org.aspectj.asm.AsmManager.removeStructureModelForFiles(AsmManager.java:564) at org.aspectj.asm.AsmManager.processDelta(AsmManager.java:639) at org.aspectj.ajdt.internal.core ... un(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: ConcurrentModificationException thrown: null Reproducible: Always Steps to Reproduce: 1.Generate an abstract class using Spring roo 2. Edit that file within Eclipse/STS to add JPA annotations 3.Click on the save icon to save the file - Exceptions box pops up
resolved fixed
749078d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-03-23T14:26:02Z
2010-03-14T01:26:40Z
asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
return classNode; else return findClassInNodes(classNode.getChildren(), innerName, typeName); } else if (name.equals(classNode.getName())) { return classNode; } else if (typeName.equals(classNode.getBytecodeSignature())) { return classNode; } else if (classNode.getChildren() != null && !classNode.getChildren().isEmpty()) { IProgramElement node = findClassInNodes(classNode.getChildren(), name, typeName); if (node != null) { return node; } } } return null; } /** * @param sourceFilePath modified to '/' delimited path for consistency * @return a new structure node for the file if it was not found in the model */ public IProgramElement findElementForSourceFile(String sourceFile) { try { if (!isValid() || sourceFile == null) { return IHierarchy.NO_STRUCTURE; } else { String correctedPath = asm.getCanonicalFilePath(new File(sourceFile)); IProgramElement node = (IProgramElement) findInFileMap(correctedPath); if (node != null) { return node;
305,788
Bug 305788 Exception was thrown when I saved a file in Eclipse
Build Identifier: SpringSource STS 2.3.1 java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$KeyIterator.next(HashMap.java:828) at org.aspectj.asm.internal.AspectJElementHierarchy.updateHandleMap(AspectJElementHierarchy.java:594) at org.aspectj.asm.AsmManager.removeStructureModelForFiles(AsmManager.java:564) at org.aspectj.asm.AsmManager.processDelta(AsmManager.java:639) at org.aspectj.ajdt.internal.core ... un(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: ConcurrentModificationException thrown: null Reproducible: Always Steps to Reproduce: 1.Generate an abstract class using Spring roo 2. Edit that file within Eclipse/STS to add JPA annotations 3.Click on the save icon to save the file - Exceptions box pops up
resolved fixed
749078d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-03-23T14:26:02Z
2010-03-14T01:26:40Z
asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
} else { return createFileStructureNode(correctedPath); } } } catch (Exception e) { return IHierarchy.NO_STRUCTURE; } } /** * TODO: discriminate columns */ public IProgramElement findElementForSourceLine(ISourceLocation location) { try { return findElementForSourceLine(asm.getCanonicalFilePath(location.getSourceFile()), location.getLine()); } catch (Exception e) { return null; } } /** * Never returns null * * @param sourceFilePath canonicalized path for consistency * @param lineNumber if 0 or 1 the corresponding file node will be returned * @return a new structure node for the file if it was not found in the model */ public IProgramElement findElementForSourceLine(String sourceFilePath, int lineNumber) { String canonicalSFP = asm.getCanonicalFilePath(new File(sourceFilePath));
305,788
Bug 305788 Exception was thrown when I saved a file in Eclipse
Build Identifier: SpringSource STS 2.3.1 java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$KeyIterator.next(HashMap.java:828) at org.aspectj.asm.internal.AspectJElementHierarchy.updateHandleMap(AspectJElementHierarchy.java:594) at org.aspectj.asm.AsmManager.removeStructureModelForFiles(AsmManager.java:564) at org.aspectj.asm.AsmManager.processDelta(AsmManager.java:639) at org.aspectj.ajdt.internal.core ... un(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: ConcurrentModificationException thrown: null Reproducible: Always Steps to Reproduce: 1.Generate an abstract class using Spring roo 2. Edit that file within Eclipse/STS to add JPA annotations 3.Click on the save icon to save the file - Exceptions box pops up
resolved fixed
749078d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-03-23T14:26:02Z
2010-03-14T01:26:40Z
asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
IProgramElement node = findNodeForSourceFile(root, canonicalSFP); if (node == null) { return createFileStructureNode(sourceFilePath); } IProgramElement closernode = findCloserMatchForLineNumber(node, lineNumber); if (closernode == null) { return node; } else { return closernode; } } /** * Discover the node representing a particular source file. * * @param node where in the model to start looking (usually the root on the initial call) * @param sourcefilePath the source file being searched for * @return the node representing that source file or null if it cannot be found */ public IProgramElement findNodeForSourceFile(IProgramElement node, String sourcefilePath) { if ((node.getKind().isSourceFile() && !node.getName().equals("<root>")) || node.getKind().isFile()) { ISourceLocation nodeLoc = node.getSourceLocation(); if (nodeLoc != null && asm.getCanonicalFilePath(nodeLoc.getSourceFile()).equals(sourcefilePath)) { return node; } return null; } else {
305,788
Bug 305788 Exception was thrown when I saved a file in Eclipse
Build Identifier: SpringSource STS 2.3.1 java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$KeyIterator.next(HashMap.java:828) at org.aspectj.asm.internal.AspectJElementHierarchy.updateHandleMap(AspectJElementHierarchy.java:594) at org.aspectj.asm.AsmManager.removeStructureModelForFiles(AsmManager.java:564) at org.aspectj.asm.AsmManager.processDelta(AsmManager.java:639) at org.aspectj.ajdt.internal.core ... un(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: ConcurrentModificationException thrown: null Reproducible: Always Steps to Reproduce: 1.Generate an abstract class using Spring roo 2. Edit that file within Eclipse/STS to add JPA annotations 3.Click on the save icon to save the file - Exceptions box pops up
resolved fixed
749078d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-03-23T14:26:02Z
2010-03-14T01:26:40Z
asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
for (Iterator iterator = node.getChildren().iterator(); iterator.hasNext();) { IProgramElement foundit = findNodeForSourceFile((IProgramElement) iterator.next(), sourcefilePath); if (foundit != null) { return foundit; } } return null; } } public IProgramElement findElementForOffSet(String sourceFilePath, int lineNumber, int offSet) { String canonicalSFP = asm.getCanonicalFilePath(new File(sourceFilePath)); IProgramElement node = findNodeForSourceLineHelper(root, canonicalSFP, lineNumber, offSet); if (node != null) { return node; } else { return createFileStructureNode(sourceFilePath); } } private IProgramElement createFileStructureNode(String sourceFilePath) { int lastSlash = sourceFilePath.lastIndexOf('\\'); if (lastSlash == -1) { lastSlash = sourceFilePath.lastIndexOf('/'); } int i = sourceFilePath.lastIndexOf('!'); int j = sourceFilePath.indexOf(".class"); if (i > lastSlash && i != -1 && j != -1) { lastSlash = i;
305,788
Bug 305788 Exception was thrown when I saved a file in Eclipse
Build Identifier: SpringSource STS 2.3.1 java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$KeyIterator.next(HashMap.java:828) at org.aspectj.asm.internal.AspectJElementHierarchy.updateHandleMap(AspectJElementHierarchy.java:594) at org.aspectj.asm.AsmManager.removeStructureModelForFiles(AsmManager.java:564) at org.aspectj.asm.AsmManager.processDelta(AsmManager.java:639) at org.aspectj.ajdt.internal.core ... un(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: ConcurrentModificationException thrown: null Reproducible: Always Steps to Reproduce: 1.Generate an abstract class using Spring roo 2. Edit that file within Eclipse/STS to add JPA annotations 3.Click on the save icon to save the file - Exceptions box pops up
resolved fixed
749078d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-03-23T14:26:02Z
2010-03-14T01:26:40Z
asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
} String fileName = sourceFilePath.substring(lastSlash + 1); IProgramElement fileNode = new ProgramElement(asm, fileName, IProgramElement.Kind.FILE_JAVA, new SourceLocation(new File( sourceFilePath), 1, 1), 0, null, null); fileNode.addChild(NO_STRUCTURE); return fileNode; } /** * For a specified node, check if any of the children more accurately represent the specified line. * * @param node where to start looking * @param lineno the line number * @return any closer match below 'node' or null if nothing is a more accurate match */ public IProgramElement findCloserMatchForLineNumber(IProgramElement node, int lineno) { if (node == null || node.getChildren() == null) { return null; } for (Iterator childrenIter = node.getChildren().iterator(); childrenIter.hasNext();) { IProgramElement child = (IProgramElement) childrenIter.next(); ISourceLocation childLoc = child.getSourceLocation(); if (childLoc != null) { if (childLoc.getLine() <= lineno && childLoc.getEndLine() >= lineno) { IProgramElement evenCloserMatch = findCloserMatchForLineNumber(child, lineno); if (evenCloserMatch == null) { return child; } else { return evenCloserMatch;
305,788
Bug 305788 Exception was thrown when I saved a file in Eclipse
Build Identifier: SpringSource STS 2.3.1 java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$KeyIterator.next(HashMap.java:828) at org.aspectj.asm.internal.AspectJElementHierarchy.updateHandleMap(AspectJElementHierarchy.java:594) at org.aspectj.asm.AsmManager.removeStructureModelForFiles(AsmManager.java:564) at org.aspectj.asm.AsmManager.processDelta(AsmManager.java:639) at org.aspectj.ajdt.internal.core ... un(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: ConcurrentModificationException thrown: null Reproducible: Always Steps to Reproduce: 1.Generate an abstract class using Spring roo 2. Edit that file within Eclipse/STS to add JPA annotations 3.Click on the save icon to save the file - Exceptions box pops up
resolved fixed
749078d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-03-23T14:26:02Z
2010-03-14T01:26:40Z
asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
} } else if (child.getKind().isType()) { IProgramElement evenCloserMatch = findCloserMatchForLineNumber(child, lineno); if (evenCloserMatch != null) { return evenCloserMatch; } } } } return null; } private IProgramElement findNodeForSourceLineHelper(IProgramElement node, String sourceFilePath, int lineno, int offset) { if (matches(node, sourceFilePath, lineno, offset) && !hasMoreSpecificChild(node, sourceFilePath, lineno, offset)) { return node; } if (node != null) { for (Iterator it = node.getChildren().iterator(); it.hasNext();) { IProgramElement foundNode = findNodeForSourceLineHelper((IProgramElement) it.next(), sourceFilePath, lineno, offset); if (foundNode != null) { return foundNode; } } } return null; } private boolean matches(IProgramElement node, String sourceFilePath, int lineNumber, int offSet) {
305,788
Bug 305788 Exception was thrown when I saved a file in Eclipse
Build Identifier: SpringSource STS 2.3.1 java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$KeyIterator.next(HashMap.java:828) at org.aspectj.asm.internal.AspectJElementHierarchy.updateHandleMap(AspectJElementHierarchy.java:594) at org.aspectj.asm.AsmManager.removeStructureModelForFiles(AsmManager.java:564) at org.aspectj.asm.AsmManager.processDelta(AsmManager.java:639) at org.aspectj.ajdt.internal.core ... un(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: ConcurrentModificationException thrown: null Reproducible: Always Steps to Reproduce: 1.Generate an abstract class using Spring roo 2. Edit that file within Eclipse/STS to add JPA annotations 3.Click on the save icon to save the file - Exceptions box pops up
resolved fixed
749078d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-03-23T14:26:02Z
2010-03-14T01:26:40Z
asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
ISourceLocation nodeSourceLocation = (node != null ? node.getSourceLocation() : null); return node != null && nodeSourceLocation != null && nodeSourceLocation.getSourceFile().getAbsolutePath().equals(sourceFilePath) && ((offSet != -1 && nodeSourceLocation.getOffset() == offSet) || offSet == -1) && ((nodeSourceLocation.getLine() <= lineNumber && nodeSourceLocation.getEndLine() >= lineNumber) || (lineNumber <= 1 && node .getKind().isSourceFile())); } private boolean hasMoreSpecificChild(IProgramElement node, String sourceFilePath, int lineNumber, int offSet) { for (Iterator it = node.getChildren().iterator(); it.hasNext();) { IProgramElement child = (IProgramElement) it.next(); if (matches(child, sourceFilePath, lineNumber, offSet)) return true; } return false; } public String getConfigFile() { return configFile; } public void setConfigFile(String configFile) { this.configFile = configFile; } public IProgramElement findElementForHandle(String handle) { return findElementForHandleOrCreate(handle, true);
305,788
Bug 305788 Exception was thrown when I saved a file in Eclipse
Build Identifier: SpringSource STS 2.3.1 java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$KeyIterator.next(HashMap.java:828) at org.aspectj.asm.internal.AspectJElementHierarchy.updateHandleMap(AspectJElementHierarchy.java:594) at org.aspectj.asm.AsmManager.removeStructureModelForFiles(AsmManager.java:564) at org.aspectj.asm.AsmManager.processDelta(AsmManager.java:639) at org.aspectj.ajdt.internal.core ... un(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: ConcurrentModificationException thrown: null Reproducible: Always Steps to Reproduce: 1.Generate an abstract class using Spring roo 2. Edit that file within Eclipse/STS to add JPA annotations 3.Click on the save icon to save the file - Exceptions box pops up
resolved fixed
749078d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-03-23T14:26:02Z
2010-03-14T01:26:40Z
asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
} public IProgramElement findElementForHandleOrCreate(String handle, boolean create) { IProgramElement ipe = (IProgramElement) handleMap.get(handle); if (ipe != null) { return ipe; } ipe = findElementForHandle(root, handle); if (ipe == null && create) { ipe = createFileStructureNode(getFilename(handle)); } if (ipe != null) { cache(handle, ipe); } return ipe; } private IProgramElement findElementForHandle(IProgramElement parent, String handle) { for (Iterator it = parent.getChildren().iterator(); it.hasNext();) { IProgramElement node = (IProgramElement) it.next(); String nodeHid = node.getHandleIdentifier(); if (handle.equals(nodeHid)) { return node; } else { if (handle.startsWith(nodeHid)) { IProgramElement childSearch = findElementForHandle(node, handle); if (childSearch != null)
305,788
Bug 305788 Exception was thrown when I saved a file in Eclipse
Build Identifier: SpringSource STS 2.3.1 java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$KeyIterator.next(HashMap.java:828) at org.aspectj.asm.internal.AspectJElementHierarchy.updateHandleMap(AspectJElementHierarchy.java:594) at org.aspectj.asm.AsmManager.removeStructureModelForFiles(AsmManager.java:564) at org.aspectj.asm.AsmManager.processDelta(AsmManager.java:639) at org.aspectj.ajdt.internal.core ... un(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: ConcurrentModificationException thrown: null Reproducible: Always Steps to Reproduce: 1.Generate an abstract class using Spring roo 2. Edit that file within Eclipse/STS to add JPA annotations 3.Click on the save icon to save the file - Exceptions box pops up
resolved fixed
749078d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-03-23T14:26:02Z
2010-03-14T01:26:40Z
asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
return childSearch; } } } return null; } protected void cache(String handle, IProgramElement pe) { if (!AsmManager.isCompletingTypeBindings()) { handleMap.put(handle, pe); } }
305,788
Bug 305788 Exception was thrown when I saved a file in Eclipse
Build Identifier: SpringSource STS 2.3.1 java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$KeyIterator.next(HashMap.java:828) at org.aspectj.asm.internal.AspectJElementHierarchy.updateHandleMap(AspectJElementHierarchy.java:594) at org.aspectj.asm.AsmManager.removeStructureModelForFiles(AsmManager.java:564) at org.aspectj.asm.AsmManager.processDelta(AsmManager.java:639) at org.aspectj.ajdt.internal.core ... un(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: ConcurrentModificationException thrown: null Reproducible: Always Steps to Reproduce: 1.Generate an abstract class using Spring roo 2. Edit that file within Eclipse/STS to add JPA annotations 3.Click on the save icon to save the file - Exceptions box pops up
resolved fixed
749078d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-03-23T14:26:02Z
2010-03-14T01:26:40Z
asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
public void flushTypeMap() { typeMap.clear(); } public void flushHandleMap() { handleMap.clear(); } public void flushFileMap() { fileMap.clear(); } public void updateHandleMap(Set deletedFiles) { List forRemoval = new ArrayList(); Set k = handleMap.keySet(); for (Iterator iter = k.iterator(); iter.hasNext();) { String handle = (String) iter.next(); IProgramElement ipe = (IProgramElement) handleMap.get(handle); if (deletedFiles.contains(getCanonicalFilePath(ipe))) forRemoval.add(handle); } for (Iterator iter = forRemoval.iterator(); iter.hasNext();) { String handle = (String) iter.next(); handleMap.remove(handle); } forRemoval.clear(); k = typeMap.keySet(); for (Iterator iter = k.iterator(); iter.hasNext();) { String typeName = (String) iter.next(); IProgramElement ipe = (IProgramElement) typeMap.get(typeName); if (deletedFiles.contains(getCanonicalFilePath(ipe)))
305,788
Bug 305788 Exception was thrown when I saved a file in Eclipse
Build Identifier: SpringSource STS 2.3.1 java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$KeyIterator.next(HashMap.java:828) at org.aspectj.asm.internal.AspectJElementHierarchy.updateHandleMap(AspectJElementHierarchy.java:594) at org.aspectj.asm.AsmManager.removeStructureModelForFiles(AsmManager.java:564) at org.aspectj.asm.AsmManager.processDelta(AsmManager.java:639) at org.aspectj.ajdt.internal.core ... un(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: ConcurrentModificationException thrown: null Reproducible: Always Steps to Reproduce: 1.Generate an abstract class using Spring roo 2. Edit that file within Eclipse/STS to add JPA annotations 3.Click on the save icon to save the file - Exceptions box pops up
resolved fixed
749078d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-03-23T14:26:02Z
2010-03-14T01:26:40Z
asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
forRemoval.add(typeName); } for (Iterator iter = forRemoval.iterator(); iter.hasNext();) { String typeName = (String) iter.next(); typeMap.remove(typeName); } forRemoval.clear(); k = fileMap.keySet(); for (Iterator iter = k.iterator(); iter.hasNext();) { String filePath = (String) iter.next(); IProgramElement ipe = (IProgramElement) fileMap.get(filePath); if (deletedFiles.contains(getCanonicalFilePath(ipe))) forRemoval.add(filePath); } for (Iterator iter = forRemoval.iterator(); iter.hasNext();) { String filePath = (String) iter.next(); fileMap.remove(filePath); } } private String getFilename(String hid) { return asm.getHandleProvider().getFileForHandle(hid); } private String getCanonicalFilePath(IProgramElement ipe) { if (ipe.getSourceLocation() != null) { return asm.getCanonicalFilePath(ipe.getSourceLocation().getSourceFile()); } return ""; } }
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
/* ******************************************************************* * 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: * PARC initial implementation * ******************************************************************/ package org.aspectj.ajdt.internal.compiler.lookup; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import org.aspectj.ajdt.internal.compiler.ast.AspectDeclaration;
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
import org.aspectj.ajdt.internal.compiler.ast.PointcutDeclaration; import org.aspectj.asm.AsmManager; import org.aspectj.bridge.IMessage; import org.aspectj.bridge.WeaveMessage; import org.aspectj.bridge.context.CompilationAndWeavingContext; import org.aspectj.bridge.context.ContextToken; import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Annotation; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.NormalAnnotation; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.SingleTypeReference; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference; import org.aspectj.org.eclipse.jdt.internal.compiler.env.AccessRestriction; import org.aspectj.org.eclipse.jdt.internal.compiler.env.IBinaryType; import org.aspectj.org.eclipse.jdt.internal.compiler.env.INameEnvironment; import org.aspectj.org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.aspectj.org.eclipse.jdt.internal.compiler.impl.ITypeRequestor; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.PackageBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TagBits;
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.problem.ProblemReporter; import org.aspectj.weaver.AnnotationAJ; import org.aspectj.weaver.ConcreteTypeMunger; import org.aspectj.weaver.ReferenceType; import org.aspectj.weaver.ReferenceTypeDelegate; import org.aspectj.weaver.ResolvedMember; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.WeaverMessages; import org.aspectj.weaver.WeaverStateInfo; import org.aspectj.weaver.World; import org.aspectj.weaver.bcel.BcelAnnotation; import org.aspectj.weaver.bcel.BcelObjectType; import org.aspectj.weaver.bcel.FakeAnnotation; import org.aspectj.weaver.bcel.LazyClassGen; import org.aspectj.weaver.patterns.DeclareAnnotation; import org.aspectj.weaver.patterns.DeclareParents; /** * Overrides the default eclipse LookupEnvironment for two purposes. * * 1. To provide some additional phases to <code>completeTypeBindings</code> that weave declare parents and inter-type declarations * at the correct time. * * 2. To intercept the loading of new binary types to ensure the they will have declare parents and inter-type declarations woven * when appropriate. * * @author Jim Hugunin */ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousClassCreationListener {
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
public EclipseFactory factory = null; private final List pendingTypesToWeave = new ArrayList();
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
/** * interfaces targetted by ITDs that have to be implemented by accessing the topMostImplementor of the interface, yet the aspect * where the ITD originated is not in the world */ private final Map dangerousInterfaces = new HashMap(); public AjLookupEnvironment(ITypeRequestor typeRequestor, CompilerOptions options, ProblemReporter problemReporter, INameEnvironment nameEnvironment) { super(typeRequestor, options, problemReporter, nameEnvironment); } public void completeTypeBindings() { AsmManager.setCompletingTypeBindings(true); ContextToken completeTypeBindingsToken = CompilationAndWeavingContext.enteringPhase( CompilationAndWeavingContext.COMPLETING_TYPE_BINDINGS, ""); stepCompleted = BUILD_TYPE_HIERARCHY; for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) { ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.CHECK_AND_SET_IMPORTS, units[i].compilationResult.fileName); units[i].scope.checkAndSetImports(); CompilationAndWeavingContext.leavingPhase(tok); } stepCompleted = CHECK_AND_SET_IMPORTS; for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.CONNECTING_TYPE_HIERARCHY, units[i].compilationResult.fileName); units[i].scope.connectTypeHierarchy(); CompilationAndWeavingContext.leavingPhase(tok); } stepCompleted = CONNECT_TYPE_HIERARCHY; for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) { ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.BUILDING_FIELDS_AND_METHODS, units[i].compilationResult.fileName); units[i].scope.buildFieldsAndMethods(); CompilationAndWeavingContext.leavingPhase(tok); } for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) { SourceTypeBinding[] b = units[i].scope.topLevelTypes; for (int j = 0; j < b.length; j++) { factory.addSourceTypeBinding(b[j], units[i]); } } AnonymousClassPublisher.aspectOf().setAnonymousClassCreationListener(this); List typesToProcess = new ArrayList();
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) { CompilationUnitScope cus = units[i].scope; SourceTypeBinding[] stbs = cus.topLevelTypes; for (int j = 0; j < stbs.length; j++) { SourceTypeBinding stb = stbs[j]; typesToProcess.add(stb); } } factory.getWorld().getCrosscuttingMembersSet().reset(); while (typesToProcess.size() > 0) { collectAllITDsAndDeclares((SourceTypeBinding) typesToProcess.get(0), typesToProcess); } factory.finishTypeMungers(); Collection typeMungers = factory.getTypeMungers(); Collection declareParents = factory.getDeclareParents(); Collection declareAnnotationOnTypes = factory.getDeclareAnnotationOnTypes(); doPendingWeaves();
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
boolean typeProcessingOrderIsImportant = declareParents.size() > 0 || declareAnnotationOnTypes.size() > 0; if (typeProcessingOrderIsImportant) { typesToProcess = new ArrayList(); for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) { CompilationUnitScope cus = units[i].scope; SourceTypeBinding[] stbs = cus.topLevelTypes; for (int j = 0; j < stbs.length; j++) { SourceTypeBinding stb = stbs[j]; typesToProcess.add(stb); } } while (typesToProcess.size() > 0) { weaveIntertypes(typesToProcess, (SourceTypeBinding) typesToProcess.get(0), typeMungers, declareParents, declareAnnotationOnTypes); } } else { for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
weaveInterTypeDeclarations(units[i].scope, typeMungers, declareParents, declareAnnotationOnTypes); } } for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) { units[i].scope.checkParameterizedTypes(); } for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) { SourceTypeBinding[] b = units[i].scope.topLevelTypes; for (int j = 0; j < b.length; j++) { ContextToken tok = CompilationAndWeavingContext.enteringPhase( CompilationAndWeavingContext.RESOLVING_POINTCUT_DECLARATIONS, b[j].sourceName); resolvePointcutDeclarations(b[j].scope); CompilationAndWeavingContext.leavingPhase(tok); } } for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) { SourceTypeBinding[] b = units[i].scope.topLevelTypes; for (int j = 0; j < b.length; j++) { ContextToken tok = CompilationAndWeavingContext.enteringPhase( CompilationAndWeavingContext.ADDING_DECLARE_WARNINGS_AND_ERRORS, b[j].sourceName); addAdviceLikeDeclares(b[j].scope); CompilationAndWeavingContext.leavingPhase(tok); } } for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) { units[i] = null; } stepCompleted = BUILD_FIELDS_AND_METHODS;
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
lastCompletedUnitIndex = lastUnitIndex; AsmManager.setCompletingTypeBindings(false); factory.getWorld().getCrosscuttingMembersSet().verify(); CompilationAndWeavingContext.leavingPhase(completeTypeBindingsToken); } /** */
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
} } } } } } public void doSupertypesFirst(ReferenceBinding rb, Collection yetToProcess) { if (rb instanceof SourceTypeBinding) { if (yetToProcess.contains(rb)) { collectAllITDsAndDeclares((SourceTypeBinding) rb, yetToProcess); } } else if (rb instanceof ParameterizedTypeBinding) { ParameterizedTypeBinding ptb = (ParameterizedTypeBinding) rb; if (ptb.type instanceof SourceTypeBinding && yetToProcess.contains(ptb.type)) { collectAllITDsAndDeclares((SourceTypeBinding) ptb.type, yetToProcess); } } } /** * Find all the ITDs and Declares, but it is important we do this from the supertypes down to the subtypes. * * @param sourceType
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
* @param yetToProcess */ private void collectAllITDsAndDeclares(SourceTypeBinding sourceType, Collection yetToProcess) { ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.COLLECTING_ITDS_AND_DECLARES, sourceType.sourceName); yetToProcess.remove(sourceType); doSupertypesFirst(sourceType.superclass(), yetToProcess); ReferenceBinding[] memberTypes = sourceType.memberTypes; for (int i = 0, length = memberTypes.length; i < length; i++) { SourceTypeBinding rb = (SourceTypeBinding) memberTypes[i]; if (!rb.superclass().equals(sourceType)) { doSupertypesFirst(rb.superclass(), yetToProcess); } } buildInterTypeAndPerClause(sourceType.scope); addCrosscuttingStructures(sourceType.scope); CompilationAndWeavingContext.leavingPhase(tok); } /** * Weave the parents and intertype decls into a given type. This method looks at the supertype and superinterfaces for the * specified type and recurses to weave those first if they are in the full list of types we are going to process during this * compile... it stops recursing the first time it hits a type we aren't going to process during this compile. This could cause * problems if you supply 'pieces' of a hierarchy, i.e. the bottom and the top, but not the middle - but what the hell are you * doing if you do that? */ private void weaveIntertypes(List typesToProcess, SourceTypeBinding typeToWeave, Collection typeMungers, Collection declareParents, Collection declareAnnotationOnTypes) {
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
ReferenceBinding superType = typeToWeave.superclass(); if (typesToProcess.contains(superType) && superType instanceof SourceTypeBinding) { weaveIntertypes(typesToProcess, (SourceTypeBinding) superType, typeMungers, declareParents, declareAnnotationOnTypes); } ReferenceBinding[] interfaceTypes = typeToWeave.superInterfaces(); for (int i = 0; i < interfaceTypes.length; i++) { ReferenceBinding binding = interfaceTypes[i]; if (typesToProcess.contains(binding) && binding instanceof SourceTypeBinding) { weaveIntertypes(typesToProcess, (SourceTypeBinding) binding, typeMungers, declareParents, declareAnnotationOnTypes); } } weaveInterTypeDeclarations(typeToWeave, typeMungers, declareParents, declareAnnotationOnTypes, false); typesToProcess.remove(typeToWeave); } private void doPendingWeaves() { for (Iterator i = pendingTypesToWeave.iterator(); i.hasNext();) { SourceTypeBinding t = (SourceTypeBinding) i.next(); ContextToken tok = CompilationAndWeavingContext.enteringPhase( CompilationAndWeavingContext.WEAVING_INTERTYPE_DECLARATIONS, t.sourceName); weaveInterTypeDeclarations(t); CompilationAndWeavingContext.leavingPhase(tok); } pendingTypesToWeave.clear(); }
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
private void addAdviceLikeDeclares(ClassScope s) { TypeDeclaration dec = s.referenceContext; if (dec instanceof AspectDeclaration) { ResolvedType typeX = factory.fromEclipse(dec.binding); factory.getWorld().getCrosscuttingMembersSet().addAdviceLikeDeclares(typeX); } SourceTypeBinding sourceType = s.referenceContext.binding; ReferenceBinding[] memberTypes = sourceType.memberTypes; for (int i = 0, length = memberTypes.length; i < length; i++) { addAdviceLikeDeclares(((SourceTypeBinding) memberTypes[i]).scope); } } private void addCrosscuttingStructures(ClassScope s) { TypeDeclaration dec = s.referenceContext; if (dec instanceof AspectDeclaration) { ResolvedType typeX = factory.fromEclipse(dec.binding); factory.getWorld().getCrosscuttingMembersSet().addOrReplaceAspect(typeX, false); if (typeX.getSuperclass().isAspect() && !typeX.getSuperclass().isExposedToWeaver()) { factory.getWorld().getCrosscuttingMembersSet().addOrReplaceAspect(typeX.getSuperclass(), false); } } SourceTypeBinding sourceType = s.referenceContext.binding; ReferenceBinding[] memberTypes = sourceType.memberTypes; for (int i = 0, length = memberTypes.length; i < length; i++) { addCrosscuttingStructures(((SourceTypeBinding) memberTypes[i]).scope); } } private void resolvePointcutDeclarations(ClassScope s) { TypeDeclaration dec = s.referenceContext; SourceTypeBinding sourceType = s.referenceContext.binding;
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
boolean hasPointcuts = false; AbstractMethodDeclaration[] methods = dec.methods; boolean initializedMethods = false; if (methods != null) { for (int i = 0; i < methods.length; i++) { if (methods[i] instanceof PointcutDeclaration) { hasPointcuts = true; if (!initializedMethods) { sourceType.methods(); initializedMethods = true; } ((PointcutDeclaration) methods[i]).resolvePointcut(s); } } } if (hasPointcuts || dec instanceof AspectDeclaration || couldBeAnnotationStyleAspectDeclaration(dec)) { ReferenceType name = (ReferenceType) factory.fromEclipse(sourceType); EclipseSourceType eclipseSourceType = (EclipseSourceType) name.getDelegate(); eclipseSourceType.checkPointcutDeclarations(); } ReferenceBinding[] memberTypes = sourceType.memberTypes; for (int i = 0, length = memberTypes.length; i < length; i++) { resolvePointcutDeclarations(((SourceTypeBinding) memberTypes[i]).scope); } } /** * Return true if the declaration has @Aspect annotation. Called 'couldBe' rather than 'is' because someone else may have * defined an annotation called Aspect - we can't verify the full name (including package name) because it may not have been * resolved just yet and rather going through expensive resolution when we dont have to, this gives us a cheap check that tells * us whether to bother.
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
*/ private boolean couldBeAnnotationStyleAspectDeclaration(TypeDeclaration dec) { Annotation[] annotations = dec.annotations; boolean couldBeAtAspect = false; if (annotations != null) { for (int i = 0; i < annotations.length && !couldBeAtAspect; i++) { if (annotations[i].toString().equals("@Aspect")) { couldBeAtAspect = true; } } } return couldBeAtAspect; } private void buildInterTypeAndPerClause(ClassScope s) { TypeDeclaration dec = s.referenceContext; if (dec instanceof AspectDeclaration) { ((AspectDeclaration) dec).buildInterTypeAndPerClause(s); } SourceTypeBinding sourceType = s.referenceContext.binding; if (sourceType.superclass != null) { ResolvedType parent = factory.fromEclipse(sourceType.superclass); if (parent.isAspect() && !isAspect(dec)) { factory.showMessage(IMessage.ERROR, "class \'" + new String(sourceType.sourceName) + "\' can not extend aspect \'" + parent.getName() + "\'", factory.fromEclipse(sourceType).getSourceLocation(), null); } } ReferenceBinding[] memberTypes = sourceType.memberTypes; for (int i = 0, length = memberTypes.length; i < length; i++) { buildInterTypeAndPerClause(((SourceTypeBinding) memberTypes[i]).scope);
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
} } private boolean isAspect(TypeDeclaration decl) { if ((decl instanceof AspectDeclaration)) { return true; } else if (decl.annotations == null) { return false; } else { for (int i = 0; i < decl.annotations.length; i++) { Annotation ann = decl.annotations[i]; if (ann.type instanceof SingleTypeReference) { if (CharOperation.equals("Aspect".toCharArray(), ((SingleTypeReference) ann.type).token)) { return true; } } else if (ann.type instanceof QualifiedTypeReference) { QualifiedTypeReference qtr = (QualifiedTypeReference) ann.type; if (qtr.tokens.length != 5) { return false; } if (!CharOperation.equals("org".toCharArray(), qtr.tokens[0])) { return false; } if (!CharOperation.equals("aspectj".toCharArray(), qtr.tokens[1])) { return false; } if (!CharOperation.equals("lang".toCharArray(), qtr.tokens[2])) { return false; } if (!CharOperation.equals("annotation".toCharArray(), qtr.tokens[3])) { return false;
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
} if (!CharOperation.equals("Aspect".toCharArray(), qtr.tokens[4])) { return false; } return true; } } } return false; } private void weaveInterTypeDeclarations(CompilationUnitScope unit, Collection typeMungers, Collection declareParents, Collection declareAnnotationOnTypes) { for (int i = 0, length = unit.topLevelTypes.length; i < length; i++) { weaveInterTypeDeclarations(unit.topLevelTypes[i], typeMungers, declareParents, declareAnnotationOnTypes, false); } } private void weaveInterTypeDeclarations(SourceTypeBinding sourceType) { if (!factory.areTypeMungersFinished()) { if (!pendingTypesToWeave.contains(sourceType)) { pendingTypesToWeave.add(sourceType); } } else { weaveInterTypeDeclarations(sourceType, factory.getTypeMungers(), factory.getDeclareParents(), factory .getDeclareAnnotationOnTypes(), true); } } private void weaveInterTypeDeclarations(SourceTypeBinding sourceType, Collection typeMungers, Collection declareParents, Collection declareAnnotationOnTypes, boolean skipInners) { ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.WEAVING_INTERTYPE_DECLARATIONS, sourceType.sourceName);
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
ResolvedType onType = factory.fromEclipse(sourceType); if (onType.isRawType()) { onType = onType.getGenericType(); } WeaverStateInfo info = onType.getWeaverState(); if (info != null && !info.isOldStyle() && !info.isReweavable()) { processTypeMungersFromExistingWeaverState(sourceType, onType); CompilationAndWeavingContext.leavingPhase(tok); return; } for (Iterator i = dangerousInterfaces.entrySet().iterator(); i.hasNext();) { Map.Entry entry = (Map.Entry) i.next(); ResolvedType interfaceType = (ResolvedType) entry.getKey(); if (onType.isTopmostImplementor(interfaceType)) { factory.showMessage(IMessage.ERROR, onType + ": " + entry.getValue(), onType.getSourceLocation(), null);
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
} } boolean needOldStyleWarning = (info != null && info.isOldStyle()); onType.clearInterTypeMungers(); List decpToRepeat = new ArrayList(); List decaToRepeat = new ArrayList(); boolean anyNewParents = false; boolean anyNewAnnotations = false; then for (Iterator i = declareParents.iterator(); i.hasNext();) { DeclareParents decp = (DeclareParents) i.next(); if (!decp.isMixin()) { boolean didSomething = doDeclareParents(decp, sourceType); if (didSomething) { anyNewParents = true; } else { if (!decp.getChild().isStarAnnotation()) { decpToRepeat.add(decp);
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
} } } } for (Iterator i = declareAnnotationOnTypes.iterator(); i.hasNext();) { DeclareAnnotation deca = (DeclareAnnotation) i.next(); boolean didSomething = doDeclareAnnotations(deca, sourceType, true); if (didSomething) { anyNewAnnotations = true; } else { if (!deca.getTypePattern().isStar()) { decaToRepeat.add(deca); } } } while ((anyNewAnnotations || anyNewParents) && (!decpToRepeat.isEmpty() || !decaToRepeat.isEmpty())) { anyNewParents = anyNewAnnotations = false; List forRemoval = new ArrayList(); for (Iterator i = decpToRepeat.iterator(); i.hasNext();) { DeclareParents decp = (DeclareParents) i.next(); boolean didSomething = doDeclareParents(decp, sourceType); if (didSomething) { anyNewParents = true; forRemoval.add(decp); } } decpToRepeat.removeAll(forRemoval); forRemoval.clear(); for (Iterator i = declareAnnotationOnTypes.iterator(); i.hasNext();) {
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
DeclareAnnotation deca = (DeclareAnnotation) i.next(); boolean didSomething = doDeclareAnnotations(deca, sourceType, false); if (didSomething) { anyNewAnnotations = true; forRemoval.add(deca); } } decaToRepeat.removeAll(forRemoval); } for (Iterator i = typeMungers.iterator(); i.hasNext();) { EclipseTypeMunger munger = (EclipseTypeMunger) i.next(); if (munger.matches(onType)) { if (needOldStyleWarning) { factory.showMessage(IMessage.WARNING, "The class for " + onType + " should be recompiled with ajc-1.1.1 for best results", onType.getSourceLocation(), null); needOldStyleWarning = false; } onType.addInterTypeMunger(munger, true); } } onType.checkInterTypeMungers(); for (Iterator i = onType.getInterTypeMungers().iterator(); i.hasNext();) { EclipseTypeMunger munger = (EclipseTypeMunger) i.next(); munger.munge(sourceType, onType); }
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
if (skipInners) { CompilationAndWeavingContext.leavingPhase(tok); return; } ReferenceBinding[] memberTypes = sourceType.memberTypes; for (int i = 0, length = memberTypes.length; i < length; i++) { if (memberTypes[i] instanceof SourceTypeBinding) { weaveInterTypeDeclarations((SourceTypeBinding) memberTypes[i], typeMungers, declareParents, declareAnnotationOnTypes, false); } } CompilationAndWeavingContext.leavingPhase(tok); } /** * Called when we discover we are weaving intertype declarations on some type that has an existing 'WeaverStateInfo' object - * this is typically some previously woven type that has been passed on the inpath. * * sourceType and onType are the 'same type' - the former is the 'Eclipse' version and the latter is the 'Weaver' version. */ private void processTypeMungersFromExistingWeaverState(SourceTypeBinding sourceType, ResolvedType onType) { Collection previouslyAppliedMungers = onType.getWeaverState().getTypeMungers(onType); for (Iterator i = previouslyAppliedMungers.iterator(); i.hasNext();) {
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
ConcreteTypeMunger m = (ConcreteTypeMunger) i.next(); EclipseTypeMunger munger = factory.makeEclipseTypeMunger(m); if (munger.munge(sourceType, onType)) { if (onType.isInterface() && munger.getMunger().needsAccessToTopmostImplementor()) { if (!onType.getWorld().getCrosscuttingMembersSet().containsAspect(munger.getAspectType())) { dangerousInterfaces .put(onType, "implementors of " + onType + " must be woven by " + munger.getAspectType()); } } } } } private boolean doDeclareParents(DeclareParents declareParents, SourceTypeBinding sourceType) { ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.PROCESSING_DECLARE_PARENTS, sourceType.sourceName); ResolvedType resolvedSourceType = factory.fromEclipse(sourceType); List newParents = declareParents.findMatchingNewParents(resolvedSourceType, false); if (!newParents.isEmpty()) { for (Iterator i = newParents.iterator(); i.hasNext();) { ResolvedType parent = (ResolvedType) i.next(); if (dangerousInterfaces.containsKey(parent)) { ResolvedType onType = factory.fromEclipse(sourceType); factory.showMessage(IMessage.ERROR, onType + ": " + dangerousInterfaces.get(parent), onType.getSourceLocation(), null); } if (Modifier.isFinal(parent.getModifiers())) { factory.showMessage(IMessage.ERROR, "cannot extend final class " + parent.getClassName(), declareParents .getSourceLocation(), null); } else {
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
if (!resolvedSourceType.isExposedToWeaver()) { return false; } addParent(sourceType, parent); } } CompilationAndWeavingContext.leavingPhase(tok); return true; } CompilationAndWeavingContext.leavingPhase(tok); return false; } private String stringifyTargets(long bits) { if ((bits & TagBits.AnnotationTargetMASK) == 0) { return ""; } Set s = new HashSet(); if ((bits & TagBits.AnnotationForAnnotationType) != 0) { s.add("ANNOTATION_TYPE"); } if ((bits & TagBits.AnnotationForConstructor) != 0) { s.add("CONSTRUCTOR"); } if ((bits & TagBits.AnnotationForField) != 0) { s.add("FIELD");
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
} if ((bits & TagBits.AnnotationForLocalVariable) != 0) { s.add("LOCAL_VARIABLE"); } if ((bits & TagBits.AnnotationForMethod) != 0) { s.add("METHOD"); } if ((bits & TagBits.AnnotationForPackage) != 0) { s.add("PACKAGE"); } if ((bits & TagBits.AnnotationForParameter) != 0) { s.add("PARAMETER"); } if ((bits & TagBits.AnnotationForType) != 0) { s.add("TYPE"); } StringBuffer sb = new StringBuffer(); sb.append("{"); for (Iterator iter = s.iterator(); iter.hasNext();) { String element = (String) iter.next(); sb.append(element); if (iter.hasNext()) { sb.append(","); } } sb.append("}"); return sb.toString(); } private boolean doDeclareAnnotations(DeclareAnnotation decA, SourceTypeBinding sourceType, boolean reportProblems) { ResolvedType rtx = factory.fromEclipse(sourceType);
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
if (!decA.matches(rtx)) { return false; } if (!rtx.isExposedToWeaver()) { return false; } ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.PROCESSING_DECLARE_ANNOTATIONS, sourceType.sourceName); UnresolvedType aspectType = decA.getAspect(); if (aspectType instanceof ReferenceType) { ReferenceType rt = (ReferenceType) aspectType; if (rt.isParameterizedType() || rt.isRawType()) { aspectType = rt.getGenericType(); } } TypeBinding tb = factory.makeTypeBinding(aspectType);
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
the 3. ? SourceTypeBinding stb = (SourceTypeBinding) tb; Annotation[] toAdd = null; long abits = 0; if (stb instanceof BinaryTypeBinding) { ReferenceType rt = (ReferenceType) factory.fromEclipse(stb); ResolvedMember[] methods = rt.getDeclaredMethods(); ResolvedMember decaMethod = null; String nameToLookFor = decA.getAnnotationMethod(); for (int i = 0; i < methods.length; i++) { if (methods[i].getName().equals(nameToLookFor)) { decaMethod = methods[i]; break; } } if (decaMethod != null) { AnnotationAJ[] axs = decaMethod.getAnnotations(); if (axs != null) { toAdd = new Annotation[1]; toAdd[0] = createAnnotationFromBcelAnnotation(axs[0], decaMethod.getSourceLocation().getOffset(), factory); if (toAdd[0].resolvedType != null) {
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
abits = toAdd[0].resolvedType.getAnnotationTagBits(); } } } } else if (stb != null) { MethodBinding[] mbs = stb.getMethods(decA.getAnnotationMethod().toCharArray()); abits = mbs[0].getAnnotationTagBits(); TypeDeclaration typeDecl = ((SourceTypeBinding) mbs[0].declaringClass).scope.referenceContext; AbstractMethodDeclaration methodDecl = typeDecl.declarationOf(mbs[0]); toAdd = methodDecl.annotations; toAdd[0] = createAnnotationCopy(toAdd[0]); if (toAdd[0].resolvedType != null) { abits = toAdd[0].resolvedType.getAnnotationTagBits(); } } } if (toAdd == null || toAdd[0] == null || toAdd[0].type == null) { CompilationAndWeavingContext.leavingPhase(tok); return false; } if (sourceType instanceof BinaryTypeBinding) { ResolvedType theTargetType = factory.fromEclipse(sourceType); TypeBinding theAnnotationType = toAdd[0].resolvedType;
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
if (theAnnotationType == null) { return false; } String sig = new String(theAnnotationType.signature()); UnresolvedType bcelAnnotationType = UnresolvedType.forSignature(sig); String name = bcelAnnotationType.getName(); if (theTargetType.hasAnnotation(bcelAnnotationType)) { CompilationAndWeavingContext.leavingPhase(tok); return false; } boolean giveupnow = false; if (((abits & TagBits.AnnotationTargetMASK) != 0)) { if (isAnnotationTargettingSomethingOtherThanAnnotationOrNormal(abits)) { giveupnow = true; } else if ((sourceType.isAnnotationType() && (abits & TagBits.AnnotationForAnnotationType) == 0) || (!sourceType.isAnnotationType() && (abits & TagBits.AnnotationForType) == 0)) { if (reportProblems) { if (decA.isExactPattern()) { factory.showMessage(IMessage.ERROR, WeaverMessages.format( WeaverMessages.INCORRECT_TARGET_FOR_DECLARE_ANNOTATION, rtx.getName(), toAdd[0].type, stringifyTargets(abits)), decA.getSourceLocation(), null); } that
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
} } } giveupnow = true; } } if (giveupnow) { CompilationAndWeavingContext.leavingPhase(tok); return false; } theTargetType.addAnnotation(new BcelAnnotation(new FakeAnnotation(name, sig, (abits & TagBits.AnnotationRuntimeRetention) != 0), factory.getWorld())); CompilationAndWeavingContext.leavingPhase(tok); return true; } Annotation currentAnnotations[] = sourceType.scope.referenceContext.annotations; if (currentAnnotations != null) { for (int i = 0; i < currentAnnotations.length; i++) { Annotation annotation = currentAnnotations[i]; String a = CharOperation.toString(annotation.type.getTypeName()); String b = CharOperation.toString(toAdd[0].type.getTypeName());
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
if (a.equals(b)) { CompilationAndWeavingContext.leavingPhase(tok); return false; } } } if (((abits & TagBits.AnnotationTargetMASK) != 0)) { if ((abits & (TagBits.AnnotationForAnnotationType | TagBits.AnnotationForType)) == 0) { CompilationAndWeavingContext.leavingPhase(tok); return false; } if ((sourceType.isAnnotationType() && (abits & TagBits.AnnotationForAnnotationType) == 0) || (!sourceType.isAnnotationType() && (abits & TagBits.AnnotationForType) == 0)) { if (reportProblems) { if (decA.isExactPattern()) { factory.showMessage(IMessage.ERROR, WeaverMessages.format( WeaverMessages.INCORRECT_TARGET_FOR_DECLARE_ANNOTATION, rtx.getName(), toAdd[0].type, stringifyTargets(abits)), decA.getSourceLocation(), null); } if
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
} } } CompilationAndWeavingContext.leavingPhase(tok); return false; } } sourceType.scope.referenceContext.rememberAnnotations(); Annotation abefore[] = sourceType.scope.referenceContext.annotations; Annotation[] newset = new Annotation[toAdd.length + (abefore == null ? 0 : abefore.length)]; System.arraycopy(toAdd, 0, newset, 0, toAdd.length); if (abefore != null) { System.arraycopy(abefore, 0, newset, toAdd.length, abefore.length); } sourceType.scope.referenceContext.annotations = newset; CompilationAndWeavingContext.leavingPhase(tok); return true; } /** * Transform an annotation from its AJ form to an eclipse form. We *DONT* care about the values of the annotation. that is * because it is only being stuck on a type during type completion to allow for other constructs (decps, decas) that might be
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
* looking for it - when the class actually gets to disk it wont have this new annotation on it and during weave time we will do * the right thing copying across values too. */ private static Annotation createAnnotationFromBcelAnnotation(AnnotationAJ annX, int pos, EclipseFactory factory) { String name = annX.getTypeName(); TypeBinding tb = factory.makeTypeBinding(annX.getType()); char[][] typeName = CharOperation.splitOn('.', name.replace('$', '.').toCharArray()); long[] positions = new long[typeName.length]; for (int i = 0; i < positions.length; i++) { positions[i] = pos; } TypeReference annType = new QualifiedTypeReference(typeName, positions); NormalAnnotation ann = new NormalAnnotation(annType, pos); ann.resolvedType = tb; return ann; } /** * Create a copy of an annotation, not deep but deep enough so we don't copy across fields that will get us into trouble like * 'recipient'
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
*/ private static Annotation createAnnotationCopy(Annotation ann) { NormalAnnotation ann2 = new NormalAnnotation(ann.type, ann.sourceStart); ann2.memberValuePairs = ann.memberValuePairs(); ann2.resolvedType = ann.resolvedType; ann2.bits = ann.bits; return ann2;
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
} private boolean isAnnotationTargettingSomethingOtherThanAnnotationOrNormal(long abits) { return (abits & (TagBits.AnnotationForAnnotationType | TagBits.AnnotationForType)) == 0; } private void reportDeclareParentsMessage(WeaveMessage.WeaveMessageKind wmk, SourceTypeBinding sourceType, ResolvedType parent) { if (!factory.getWorld().getMessageHandler().isIgnoring(IMessage.WEAVEINFO)) { String filename = new String(sourceType.getFileName()); int takefrom = filename.lastIndexOf('/'); if (takefrom == -1) { takefrom = filename.lastIndexOf('\\'); } filename = filename.substring(takefrom + 1); factory.getWorld().getMessageHandler().handleMessage( WeaveMessage.constructWeavingMessage(wmk, new String[] { CharOperation.toString(sourceType.compoundName), filename, parent.getClassName(), getShortname(parent.getSourceLocation().getSourceFile().getPath()) })); } } private String getShortname(String path) { int takefrom = path.lastIndexOf('/'); if (takefrom == -1) { takefrom = path.lastIndexOf('\\'); } return path.substring(takefrom + 1); } private void addParent(SourceTypeBinding sourceType, ResolvedType parent) { ReferenceBinding parentBinding = (ReferenceBinding) factory.makeTypeBinding(parent); if (parentBinding == null) { return; }
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
sourceType.rememberTypeHierarchy(); if (parentBinding.isClass()) { sourceType.superclass = parentBinding; } else { ReferenceBinding[] oldI = sourceType.superInterfaces; ReferenceBinding[] newI; if (oldI == null) { newI = new ReferenceBinding[1]; newI[0] = parentBinding; } else { int n = oldI.length; newI = new ReferenceBinding[n + 1]; System.arraycopy(oldI, 0, newI, 0, n); newI[n] = parentBinding; } sourceType.superInterfaces = newI;
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
} if (sourceType instanceof BinaryTypeBinding) { ResolvedType onType = factory.fromEclipse(sourceType); ReferenceType rt = (ReferenceType) onType; ReferenceTypeDelegate rtd = rt.getDelegate(); if (rtd instanceof BcelObjectType) { rt.addParent(parent); } } } public void warnOnAddedInterface(ResolvedType type, ResolvedType parent) { World world = factory.getWorld(); ResolvedType serializable = world.getCoreType(UnresolvedType.SERIALIZABLE); if (serializable.isAssignableFrom(type) && !serializable.isAssignableFrom(parent) && !LazyClassGen.hasSerialVersionUIDField(type)) { world.getLint().needsSerialVersionUIDField.signal(new String[] { type.getName().toString(), "added interface " + parent.getName().toString() }, null, null); } } private final List pendingTypesToFinish = new ArrayList(); boolean inBinaryTypeCreationAndWeaving = false; boolean processingTheQueue = false; public BinaryTypeBinding createBinaryTypeFrom(IBinaryType binaryType, PackageBinding packageBinding, boolean needFieldsAndMethods, AccessRestriction accessRestriction) { if (inBinaryTypeCreationAndWeaving) { BinaryTypeBinding ret = super.createBinaryTypeFrom(binaryType, packageBinding, needFieldsAndMethods, accessRestriction);
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
pendingTypesToFinish.add(ret); return ret; } inBinaryTypeCreationAndWeaving = true; try { BinaryTypeBinding ret = super.createBinaryTypeFrom(binaryType, packageBinding, needFieldsAndMethods, accessRestriction); factory.getWorld().validateType(factory.fromBinding(ret)); weaveInterTypeDeclarations(ret); return ret; } finally { inBinaryTypeCreationAndWeaving = false; if (pendingTypesToFinish.size() > 0) { processingTheQueue = true; while (!pendingTypesToFinish.isEmpty()) { BinaryTypeBinding nextVictim = (BinaryTypeBinding) pendingTypesToFinish.remove(0); weaveInterTypeDeclarations(nextVictim); } processingTheQueue = false; } } } /** * Callback driven when the compiler detects an anonymous type during block resolution. We need to add it to the weaver so that * we don't trip up later. *
308,093
Bug 308093 incremental build problem when mixing up ITDs and declare parents
reported by Rod Johnson. He had a sophisticated aspect doing a mix of ITDs and declare parents. On doing an incremental build he was receiving errors that looked like the declare parents hadn't applied on the secondary build. What was actually happening is that when a class file was brought in as a BinaryTypeBinding, the existing World representation wasn't being cleaned up properly. Without the cleanup the declare parents thought it was still in effect, but it was not. With proper cleanup the declare parents applies on the secondary build and all is well. Change is in AjLookupEnviroment.weaveInterTypeDeclarations where the onType.clearInterTypeMungers() must be paired with an onType.ensureConsistent() call.
resolved fixed
4b43dc6
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-05T18:25:10Z
2010-04-05T17:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
* @param aBinding */ public void anonymousTypeBindingCreated(LocalTypeBinding aBinding) { factory.addSourceTypeBinding(aBinding, null); } } } } } } } } } } } }
308,386
Bug 308386 NPE when hasfield evaluating with annotations and there is an unresolved import
hasfield/hasmethod can cause early matching - before the weaving process kicks in properly. For a 'normal' compile error, like an unresolvable import, the error is put out before the weaving process kicks off. However hasfield/hasmethod happening early causes an NPE to occur before the error is put out. A guard for the NPE (which occurs in EclipseResolvedMember.getAnnotationTypes()) addresses this problem and allows the real error to come out.
resolved fixed
94d0a4e
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-07T19:24:04Z
2010-04-07T19:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java
/* ******************************************************************* * Copyright (c) 2006 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 implementation * ******************************************************************/ package org.aspectj.ajdt.internal.compiler.lookup; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Annotation; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AnnotationMethodDeclaration; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Argument; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Expression; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.FalseLiteral;
308,386
Bug 308386 NPE when hasfield evaluating with annotations and there is an unresolved import
hasfield/hasmethod can cause early matching - before the weaving process kicks in properly. For a 'normal' compile error, like an unresolvable import, the error is put out before the weaving process kicks off. However hasfield/hasmethod happening early causes an NPE to occur before the error is put out. A guard for the NPE (which occurs in EclipseResolvedMember.getAnnotationTypes()) addresses this problem and allows the real error to come out.
resolved fixed
94d0a4e
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-07T19:24:04Z
2010-04-07T19:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.IntLiteral; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.StringLiteral; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TrueLiteral; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.aspectj.org.eclipse.jdt.internal.compiler.impl.IntConstant; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Binding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.FieldBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; import org.aspectj.weaver.AnnotationAJ; import org.aspectj.weaver.BCException; import org.aspectj.weaver.MemberKind; import org.aspectj.weaver.ResolvedMemberImpl; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.World; /** * In the pipeline world, we can be weaving before all types have come through from compilation. In some cases this means the weaver * will want to ask questions of eclipse types and this subtype of ResolvedMemberImpl is here to answer some of those questions - it * is backed by the real eclipse MethodBinding object and can translate from Eclipse -> Weaver information. */ public class EclipseResolvedMember extends ResolvedMemberImpl { private static String[] NO_ARGS = new String[] {}; private Binding realBinding; private String[] argumentNames; private World w;
308,386
Bug 308386 NPE when hasfield evaluating with annotations and there is an unresolved import
hasfield/hasmethod can cause early matching - before the weaving process kicks in properly. For a 'normal' compile error, like an unresolvable import, the error is put out before the weaving process kicks off. However hasfield/hasmethod happening early causes an NPE to occur before the error is put out. A guard for the NPE (which occurs in EclipseResolvedMember.getAnnotationTypes()) addresses this problem and allows the real error to come out.
resolved fixed
94d0a4e
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-07T19:24:04Z
2010-04-07T19:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java
private ResolvedType[] cachedAnnotationTypes; private EclipseFactory eclipseFactory; public EclipseResolvedMember(MethodBinding binding, MemberKind memberKind, ResolvedType realDeclaringType, int modifiers, UnresolvedType rettype, String name, UnresolvedType[] paramtypes, UnresolvedType[] extypes, EclipseFactory eclipseFactory) { super(memberKind, realDeclaringType, modifiers, rettype, name, paramtypes, extypes); this.realBinding = binding; this.eclipseFactory = eclipseFactory; this.w = realDeclaringType.getWorld(); } public EclipseResolvedMember(FieldBinding binding, MemberKind field, ResolvedType realDeclaringType, int modifiers, ResolvedType type, String string, UnresolvedType[] none) { super(field, realDeclaringType, modifiers, type, string, none); this.realBinding = binding; this.w = realDeclaringType.getWorld(); } public boolean hasAnnotation(UnresolvedType ofType) { ResolvedType[] annotationTypes = getAnnotationTypes(); if (annotationTypes == null) return false; for (int i = 0; i < annotationTypes.length; i++) { ResolvedType type = annotationTypes[i]; if (type.equals(ofType)) return true; } return false; } public AnnotationAJ[] getAnnotations() { realBinding.getAnnotationTagBits();
308,386
Bug 308386 NPE when hasfield evaluating with annotations and there is an unresolved import
hasfield/hasmethod can cause early matching - before the weaving process kicks in properly. For a 'normal' compile error, like an unresolvable import, the error is put out before the weaving process kicks off. However hasfield/hasmethod happening early causes an NPE to occur before the error is put out. A guard for the NPE (which occurs in EclipseResolvedMember.getAnnotationTypes()) addresses this problem and allows the real error to come out.
resolved fixed
94d0a4e
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-07T19:24:04Z
2010-04-07T19:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java
Annotation[] annos = getEclipseAnnotations(); if (annos == null) { return null; } AnnotationAJ[] annoAJs = new AnnotationAJ[annos.length]; for (int i = 0; i < annos.length; i++) { annoAJs[i] = EclipseAnnotationConvertor.convertEclipseAnnotation(annos[i], w, eclipseFactory); } return annoAJs; } public AnnotationAJ getAnnotationOfType(UnresolvedType ofType) { realBinding.getAnnotationTagBits(); Annotation[] annos = getEclipseAnnotations(); if (annos == null) return null; for (int i = 0; i < annos.length; i++) { Annotation anno = annos[i]; UnresolvedType ut = UnresolvedType.forSignature(new String(anno.resolvedType.signature())); if (w.resolve(ut).equals(ofType)) { return EclipseAnnotationConvertor.convertEclipseAnnotation(anno, w, eclipseFactory); } } return null; } public String getAnnotationDefaultValue() { if (realBinding instanceof MethodBinding) { AbstractMethodDeclaration methodDecl = getTypeDeclaration().declarationOf((MethodBinding) realBinding); if (methodDecl instanceof AnnotationMethodDeclaration) {
308,386
Bug 308386 NPE when hasfield evaluating with annotations and there is an unresolved import
hasfield/hasmethod can cause early matching - before the weaving process kicks in properly. For a 'normal' compile error, like an unresolvable import, the error is put out before the weaving process kicks off. However hasfield/hasmethod happening early causes an NPE to occur before the error is put out. A guard for the NPE (which occurs in EclipseResolvedMember.getAnnotationTypes()) addresses this problem and allows the real error to come out.
resolved fixed
94d0a4e
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-07T19:24:04Z
2010-04-07T19:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java
AnnotationMethodDeclaration annoMethodDecl = (AnnotationMethodDeclaration) methodDecl; Expression e = annoMethodDecl.defaultValue; if (e.resolvedType == null) e.resolve(methodDecl.scope); if (e instanceof QualifiedNameReference) { QualifiedNameReference qnr = (QualifiedNameReference) e; if (qnr.binding instanceof FieldBinding) { FieldBinding fb = (FieldBinding) qnr.binding; StringBuffer sb = new StringBuffer(); sb.append(fb.declaringClass.signature()); sb.append(fb.name); return sb.toString(); } } else if (e instanceof TrueLiteral) { return "true"; } else if (e instanceof FalseLiteral) { return "false"; } else if (e instanceof StringLiteral) { return new String(((StringLiteral) e).source()); } else if (e instanceof IntLiteral) { return Integer.toString(((IntConstant) e.constant).intValue()); } else { throw new BCException("EclipseResolvedMember.getAnnotationDefaultValue() not implemented for value of type '" + e.getClass() + "' - raise an AspectJ bug !"); } } } return null; }
308,386
Bug 308386 NPE when hasfield evaluating with annotations and there is an unresolved import
hasfield/hasmethod can cause early matching - before the weaving process kicks in properly. For a 'normal' compile error, like an unresolvable import, the error is put out before the weaving process kicks off. However hasfield/hasmethod happening early causes an NPE to occur before the error is put out. A guard for the NPE (which occurs in EclipseResolvedMember.getAnnotationTypes()) addresses this problem and allows the real error to come out.
resolved fixed
94d0a4e
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-07T19:24:04Z
2010-04-07T19:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java
public ResolvedType[] getAnnotationTypes() { if (cachedAnnotationTypes == null) { realBinding.getAnnotationTagBits(); Annotation[] annos = getEclipseAnnotations(); if (annos == null) { cachedAnnotationTypes = ResolvedType.EMPTY_RESOLVED_TYPE_ARRAY; } else { cachedAnnotationTypes = new ResolvedType[annos.length]; for (int i = 0; i < annos.length; i++) { Annotation type = annos[i]; cachedAnnotationTypes[i] = w.resolve(UnresolvedType.forSignature(new String(type.resolvedType.signature()))); } } } return cachedAnnotationTypes; } public String[] getParameterNames() { if (argumentNames != null) return argumentNames; if (realBinding instanceof FieldBinding) { argumentNames = NO_ARGS; } else { TypeDeclaration typeDecl = getTypeDeclaration(); AbstractMethodDeclaration methodDecl = (typeDecl == null ? null : typeDecl.declarationOf((MethodBinding) realBinding)); Argument[] args = (methodDecl == null ? null : methodDecl.arguments);
308,386
Bug 308386 NPE when hasfield evaluating with annotations and there is an unresolved import
hasfield/hasmethod can cause early matching - before the weaving process kicks in properly. For a 'normal' compile error, like an unresolvable import, the error is put out before the weaving process kicks off. However hasfield/hasmethod happening early causes an NPE to occur before the error is put out. A guard for the NPE (which occurs in EclipseResolvedMember.getAnnotationTypes()) addresses this problem and allows the real error to come out.
resolved fixed
94d0a4e
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-07T19:24:04Z
2010-04-07T19:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java
if (args == null) { argumentNames = NO_ARGS; } else { argumentNames = new String[args.length]; for (int i = 0; i < argumentNames.length; i++) { argumentNames[i] = new String(methodDecl.arguments[i].name); } } } return argumentNames; } private Annotation[] getEclipseAnnotations() { TypeDeclaration tDecl = getTypeDeclaration(); if (tDecl != null) { if (realBinding instanceof MethodBinding) { MethodBinding methodBinding = (MethodBinding) realBinding; AbstractMethodDeclaration methodDecl = tDecl.declarationOf(methodBinding); if (methodDecl == null) { MethodBinding[] mb = ((MethodBinding) realBinding).declaringClass.getMethods(methodBinding.selector); if (mb!=null) {
308,386
Bug 308386 NPE when hasfield evaluating with annotations and there is an unresolved import
hasfield/hasmethod can cause early matching - before the weaving process kicks in properly. For a 'normal' compile error, like an unresolvable import, the error is put out before the weaving process kicks off. However hasfield/hasmethod happening early causes an NPE to occur before the error is put out. A guard for the NPE (which occurs in EclipseResolvedMember.getAnnotationTypes()) addresses this problem and allows the real error to come out.
resolved fixed
94d0a4e
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-07T19:24:04Z
2010-04-07T19:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java
for (int m = 0, max = mb.length; m < max; m++) { MethodBinding candidate = mb[m]; if (candidate instanceof InterTypeMethodBinding) { if (InterTypeMemberFinder.matches(mb[m], methodBinding)) { InterTypeMethodBinding intertypeMethodBinding = (InterTypeMethodBinding) candidate; Annotation[] annos = intertypeMethodBinding.sourceMethod.annotations; return annos; } } } } return null; } return methodDecl.annotations; } else if (realBinding instanceof FieldBinding) { FieldDeclaration fieldDecl = tDecl.declarationOf((FieldBinding) realBinding); return fieldDecl.annotations; } } return null; } private TypeDeclaration getTypeDeclaration() { if (realBinding instanceof MethodBinding) { MethodBinding mb = (MethodBinding) realBinding; if (mb != null) { SourceTypeBinding stb = (SourceTypeBinding) mb.declaringClass; if (stb != null) { ClassScope cScope = stb.scope; if (cScope != null) return cScope.referenceContext;
308,386
Bug 308386 NPE when hasfield evaluating with annotations and there is an unresolved import
hasfield/hasmethod can cause early matching - before the weaving process kicks in properly. For a 'normal' compile error, like an unresolvable import, the error is put out before the weaving process kicks off. However hasfield/hasmethod happening early causes an NPE to occur before the error is put out. A guard for the NPE (which occurs in EclipseResolvedMember.getAnnotationTypes()) addresses this problem and allows the real error to come out.
resolved fixed
94d0a4e
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-07T19:24:04Z
2010-04-07T19:53:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseResolvedMember.java
} } } else if (realBinding instanceof FieldBinding) { FieldBinding fb = (FieldBinding) realBinding; if (fb != null) { SourceTypeBinding stb = (SourceTypeBinding) fb.declaringClass; if (stb != null) { ClassScope cScope = stb.scope; if (cScope != null) return cScope.referenceContext; } } } return null; } /** * Return true if this is the default constructor. The default constructor is the one generated if there isn't one in the * source. Eclipse helpfully uses a bit to indicate the default constructor. * * @return true if this is the default constructor. */ public boolean isDefaultConstructor() { if (!(realBinding instanceof MethodBinding)) { return false; } MethodBinding mb = (MethodBinding) realBinding; return mb.isConstructor() && ((mb.modifiers & ExtraCompilerModifiers.AccIsDefaultConstructor) != 0); } }
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
/* ******************************************************************* * 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: * PARC initial implementation * ******************************************************************/ package org.aspectj.tools.ajc; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; import java.util.Arrays; import java.util.Date; import java.util.List; import org.aspectj.ajdt.internal.core.builder.AjBuildManager; import org.aspectj.bridge.AbortException; import org.aspectj.bridge.ICommand; import org.aspectj.bridge.IMessage; import org.aspectj.bridge.IMessageHandler; import org.aspectj.bridge.IMessageHolder; import org.aspectj.bridge.ISourceLocation; import org.aspectj.bridge.Message;
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
import org.aspectj.bridge.MessageHandler; import org.aspectj.bridge.MessageUtil; import org.aspectj.bridge.ReflectionFactory; import org.aspectj.bridge.Version; import org.aspectj.bridge.IMessage.Kind; import org.aspectj.bridge.context.CompilationAndWeavingContext; import org.aspectj.util.FileUtil; import org.aspectj.util.LangUtil; import org.aspectj.weaver.Dump; /** * Programmatic and command-line interface to AspectJ compiler. The compiler is an ICommand obtained by reflection. Not thread-safe. * By default, messages are printed as they are emitted; info messages go to the output stream, and warnings and errors go to the * error stream. * <p> * Clients can handle all messages by registering a holder: * * <pre> * Main main = new Main(); * IMessageHolder holder = new MessageHandler(); * main.setHolder(holder); * </pre> * * Clients can get control after each command completes by installing a Runnable: * * <pre> * main.setCompletionRunner(new Runnable() {..}); * </pre> * */ public class Main {
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
public static final String THROWN_PREFIX = "Exception thrown from AspectJ " + Version.text + LangUtil.EOL + "" + LangUtil.EOL + "This might be logged as a bug already -- find current bugs at" + LangUtil.EOL + " http://bugs.eclipse.org/bugs/buglist.cgi?product=AspectJ&component=Compiler" + LangUtil.EOL + "" + LangUtil.EOL + "Bugs for exceptions thrown have titles File:line from the top stack, " + LangUtil.EOL + "e.g., \"SomeFile.java:243\"" + LangUtil.EOL + "" + LangUtil.EOL + "If you don't find the exception below in a bug, please add a new bug" + LangUtil.EOL + "at http://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ" + LangUtil.EOL + "To make the bug a priority, please include a test program" + LangUtil.EOL + "that can reproduce this exception." + LangUtil.EOL; private static final String OUT_OF_MEMORY_MSG = "AspectJ " + Version.text + " ran out of memory during compilation:" + LangUtil.EOL + LangUtil.EOL + "Please increase the memory available to ajc by editing the ajc script " + LangUtil.EOL + "found in your AspectJ installation directory. The -Xmx parameter value" + LangUtil.EOL + "should be increased from 64M (default) to 128M or even 256M." + LangUtil.EOL + LangUtil.EOL + "See the AspectJ FAQ available from the documentation link" + LangUtil.EOL + "on the AspectJ home page at http://www.eclipse.org/aspectj"; private static final String MESSAGE_HOLDER_OPTION = "-messageHolder";
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
public static void main(String[] args) throws IOException { new Main().runMain(args, true); } /** * Convenience method to run ajc and collect String lists of messages. This can be reflectively invoked with the List collecting * parameters supplied by a parent class loader. The String messages take the same form as command-line messages. * * @param args the String[] args to pass to the compiler * @param useSystemExit if true and errors, return System.exit(errs) * @param fails the List sink, if any, for String failure (or worse) messages * @param errors the List sink, if any, for String error messages * @param warnings the List sink, if any, for String warning messages * @param info the List sink, if any, for String info messages * @return number of messages reported with level ERROR or above * @throws any unchecked exceptions the compiler does */ public static int bareMain(String[] args, boolean useSystemExit, List fails, List errors, List warnings, List infos) { Main main = new Main(); MessageHandler holder = new MessageHandler(); main.setHolder(holder); try { main.runMain(args, useSystemExit); } finally { readMessages(holder, IMessage.FAIL, true, fails); readMessages(holder, IMessage.ERROR, false, errors); readMessages(holder, IMessage.WARNING, false, warnings); readMessages(holder, IMessage.INFO, false, infos); } return holder.numMessages(IMessage.ERROR, true);
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
} private static void readMessages(IMessageHolder holder, IMessage.Kind kind, boolean orGreater, List sink) { if ((null == sink) || (null == holder)) { return; } IMessage[] messages = holder.getMessages(kind, orGreater); if (!LangUtil.isEmpty(messages)) { for (int i = 0; i < messages.length; i++) { sink.add(MessagePrinter.render(messages[i])); } } } /** * @return String rendering throwable as compiler error for user/console, including information on how to report as a bug. * @throws NullPointerException if thrown is null */ public static String renderExceptionForUser(Throwable thrown) { String m = thrown.getMessage(); return THROWN_PREFIX + (null != m ? m + "\n" : "") + "\n" + CompilationAndWeavingContext.getCurrentContext() + LangUtil.renderException(thrown, true); } private static String parmInArgs(String flag, String[] args) { int loc = 1 + (null == args ? -1 : Arrays.asList(args).indexOf(flag)); return ((0 == loc) || (args.length <= loc) ? null : args[loc]); } private static boolean flagInArgs(String flag, String[] args) { return ((null != args) && (Arrays.asList(args).indexOf(flag) != -1)); } /**
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
* append nothing if numItems is 0, numItems + label + (numItems > 1? "s" : "") otherwise, prefixing with " " if sink has * content */ private static void appendNLabel(StringBuffer sink, String label, int numItems) { if (0 == numItems) { return; } if (0 < sink.length()) { sink.append(", "); } sink.append(numItems + " "); if (!LangUtil.isEmpty(label)) { sink.append(label); } if (1 < numItems) { sink.append("s"); } } protected CommandController controller; protected String commandName; private IMessageHolder clientHolder; protected final MessageHandler ourHandler; private int lastFails; private int lastErrors; private Runnable completionRunner;
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
public Main() { controller = new CommandController(); commandName = ReflectionFactory.ECLIPSE; CompilationAndWeavingContext.setMultiThreaded(false); ourHandler = new MessageHandler(true); } public MessageHandler getMessageHandler() { return ourHandler; } void setController(CommandController controller) { this.controller = controller; } /** * Run without throwing exceptions but optionally using System.exit(..). This sets up a message handler which emits messages * immediately, so report(boolean, IMessageHandler) only reports total number of errors or warnings. * * @param args the String[] command line for the compiler * @param useSystemExit if true, use System.exit(int) to complete unless one of the args is -noExit. and signal result (0 no * exceptions/error, <0 exceptions, >0 compiler errors). */ public void runMain(String[] args, boolean useSystemExit) { AjBuildManager.enableRuntimeVersionCheck(this); final boolean verbose = flagInArgs("-verbose", args); final boolean timers = flagInArgs("-timers", args); if (null == this.clientHolder) { this.clientHolder = checkForCustomMessageHolder(args); } IMessageHolder holder = clientHolder;
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
if (null == holder) { holder = ourHandler; if (verbose) { ourHandler.setInterceptor(MessagePrinter.VERBOSE); } else { ourHandler.ignore(IMessage.INFO); ourHandler.setInterceptor(MessagePrinter.TERSE); } } try { long stime = System.currentTimeMillis(); run(args, holder); long etime = System.currentTimeMillis(); if (timers) { System.out.println("Compiler took " + (etime - stime) + "ms"); } holder.handleMessage(MessageUtil.info("Compiler took " + (etime - stime) + "ms")); } catch (OutOfMemoryError outOfMemory) { IMessage outOfMemoryMessage = new Message(OUT_OF_MEMORY_MSG, null, true); holder.handleMessage(outOfMemoryMessage); systemExit(holder); } finally { CompilationAndWeavingContext.reset(); Dump.reset();
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
} boolean skipExit = false; if (useSystemExit && !LangUtil.isEmpty(args)) { for (int i = 0; i < args.length; i++) { if ("-noExit".equals(args[i])) { skipExit = true; break; } } } if (useSystemExit && !skipExit) { systemExit(holder); } } /** * @param args */ private IMessageHolder checkForCustomMessageHolder(String[] args) { IMessageHolder holder = null; final String customMessageHolder = parmInArgs(MESSAGE_HOLDER_OPTION, args);
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
if (customMessageHolder != null) { try { holder = (IMessageHolder) Class.forName(customMessageHolder).newInstance(); } catch (Exception ex) { holder = ourHandler; throw new AbortException("Failed to create custom message holder of class '" + customMessageHolder + "' : " + ex); } } return holder; } /** * Run without using System.exit(..), putting all messages in holder: * <ul> * <li>ERROR: compiler error</li> * <li>WARNING: compiler warning</li> * <li>FAIL: command error (bad arguments, exception thrown)</li> * </ul> * This handles incremental behavior: * <ul> * <li>If args include "-incremental", repeat for every input char until 'q' is entered. * <li> * <li>If args include "-incrementalTagFile {file}", repeat every time we detect that {file} modification time has changed.</li> * <li>Either way, list files recompiled each time if args includes "-verbose".</li> * <li>Exit when the commmand/compiler throws any Throwable.</li> * </ul> * When complete, this contains all the messages of the final run of the command and/or any FAIL messages produced in running * the command, including any Throwable thrown by the command itself. * * @param args the String[] command line for the compiler * @param holder the MessageHandler sink for messages.
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
*/ public void run(String[] args, IMessageHolder holder) { PrintStream logStream = null; FileOutputStream fos = null; String logFileName = parmInArgs("-log", args); if (null != logFileName) { File logFile = new File(logFileName); try { logFile.createNewFile(); fos = new FileOutputStream(logFileName, true); logStream = new PrintStream(fos, true); } catch (Exception e) { fail(holder, "Couldn't open log file: " + logFileName, e); } Date now = new Date(); logStream.println(now.toString()); if (flagInArgs("-verbose", args)) { ourHandler.setInterceptor(new LogModeMessagePrinter(true, logStream)); } else { ourHandler.ignore(IMessage.INFO); ourHandler.setInterceptor(new LogModeMessagePrinter(false, logStream)); } holder = ourHandler; } if (LangUtil.isEmpty(args)) { args = new String[] { "-?" }; } else if (controller.running()) { fail(holder, "already running with controller: " + controller, null); return; }
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
args = controller.init(args, holder); if (0 < holder.numMessages(IMessage.ERROR, true)) { return; } ICommand command = ReflectionFactory.makeCommand(commandName, holder); if (0 < holder.numMessages(IMessage.ERROR, true)) { return; } try { outer: while (true) { boolean passed = command.runCommand(args, holder); if (report(passed, holder) && controller.incremental()) { while (controller.doRepeatCommand(command)) { holder.clearMessages(); if (controller.buildFresh()) { continue outer; } else { passed = command.repeatCommand(holder); } if (!report(passed, holder)) { break; } } } break; } } catch (AbortException ae) { if (ae.isSilent()) { quit(); } else {
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
IMessage message = ae.getIMessage(); Throwable thrown = ae.getThrown(); if (null == thrown) { if (null != message) { holder.handleMessage(message); } else { fail(holder, "abort without message", ae); } } else if (null == message) { fail(holder, "aborted", thrown); } else { String mssg = MessageUtil.MESSAGE_MOST.renderToString(message); fail(holder, mssg, thrown); } } } catch (Throwable t) { fail(holder, "unexpected exception", t); } finally { if (logStream != null) { logStream.close(); logStream = null; } if (fos != null) { try { fos.close(); } catch (IOException e) { fail(holder, "unexpected exception", e); } fos = null; }
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
} } public void quit() { controller.quit(); } /** * Set holder to be passed all messages. When holder is set, messages will not be printed by default. * * @param holder the IMessageHolder sink for all messages (use null to restore default behavior) */ public void setHolder(IMessageHolder holder) { clientHolder = holder; } public IMessageHolder getHolder() { return clientHolder; } /** * Install a Runnable to be invoked synchronously after each compile completes. * * @param runner the Runnable to invoke - null to disable */ public void setCompletionRunner(Runnable runner) { this.completionRunner = runner; } /** * Call System.exit(int) with values derived from the number of failures/aborts or errors in messages. * * @param messages the IMessageHolder to interrogate. * @param messages
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
*/ protected void systemExit(IMessageHolder messages) { int num = lastFails; if (0 < num) { System.exit(-num); } num = lastErrors; if (0 < num) { System.exit(num); } System.exit(0); } protected void outMessage(String message) { System.out.print(message); System.out.flush(); } /** * Report results from a (possibly-incremental) compile run. This delegates to any reportHandler or otherwise prints summary * counts of errors/warnings to System.err (if any errors) or System.out (if only warnings). WARNING: this silently ignores * other messages like FAIL, but clears the handler of all messages when returning true. XXX false * * This implementation ignores the pass parameter but clears the holder after reporting on the assumption messages were * handled/printed already. (ignoring UnsupportedOperationException from holder.clearMessages()). * * @param pass true result of the command * @param holder IMessageHolder with messages from the command * @see reportCommandResults(IMessageHolder) * @return false if the process should abort */
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
protected boolean report(boolean pass, IMessageHolder holder) { lastFails = holder.numMessages(IMessage.FAIL, true); boolean result = (0 == lastFails); final Runnable runner = completionRunner; if (null != runner) { runner.run(); } if (holder == ourHandler) { lastErrors = holder.numMessages(IMessage.ERROR, false); int warnings = holder.numMessages(IMessage.WARNING, false); StringBuffer sb = new StringBuffer(); appendNLabel(sb, "fail|abort", lastFails); appendNLabel(sb, "error", lastErrors); appendNLabel(sb, "warning", warnings); if (0 < sb.length()) { PrintStream out = (0 < (lastErrors + lastFails) ? System.err : System.out); out.println(""); out.println(sb.toString()); } } return result; } protected static void fail(IMessageHandler handler, String message, Throwable thrown) { handler.handleMessage(new Message(message, IMessage.FAIL, thrown, null)); } /** * interceptor IMessageHandler to print as we go. This formats all messages to the user. */ public static class MessagePrinter implements IMessageHandler {
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
public static final IMessageHandler VERBOSE = new MessagePrinter(true); public static final IMessageHandler TERSE = new MessagePrinter(false); final boolean verbose; protected MessagePrinter(boolean verbose) { this.verbose = verbose; } /** * Print errors and warnings to System.err, and optionally info to System.out, rendering message String only. * * @return false always */ public boolean handleMessage(IMessage message) { if (null != message) { PrintStream out = getStreamFor(message.getKind()); if (null != out) { out.println(render(message)); } } return false; }
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
/** * Render message differently. If abort, then prefix stack trace with feedback request. If the actual message is empty, then * use toString on the whole. Prefix message part with file:line; If it has context, suffix message with context. * * @param message the IMessage to render * @return String rendering IMessage (never null) */ public static String render(IMessage message) { StringBuffer sb = new StringBuffer(); String text = message.getMessage(); if (text.equals(AbortException.NO_MESSAGE_TEXT)) { text = null; } boolean toString = (LangUtil.isEmpty(text)); if (toString) { text = message.toString(); } ISourceLocation loc = message.getSourceLocation(); String context = null; if (null != loc) { File file = loc.getSourceFile(); if (null != file) { String name = file.getName(); if (!toString || (-1 == text.indexOf(name))) { sb.append(FileUtil.getBestPath(file)); if (loc.getLine() > 0) { sb.append(":" + loc.getLine()); } int col = loc.getColumn();
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
if (0 < col) { sb.append(":" + col); } sb.append(" "); } } context = loc.getContext(); } if (message.getKind() == IMessage.ERROR) { sb.append("[error] "); } else if (message.getKind() == IMessage.WARNING) { sb.append("[warning] "); } sb.append(text); if (null != context) { sb.append(LangUtil.EOL); sb.append(context); } String details = message.getDetails(); if (details != null) { sb.append(LangUtil.EOL); sb.append('\t'); sb.append(details); } Throwable thrown = message.getThrown(); if (null != thrown) { sb.append(LangUtil.EOL); sb.append(Main.renderExceptionForUser(thrown)); }
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
if (message.getExtraSourceLocations().isEmpty()) { return sb.toString(); } else { return MessageUtil.addExtraSourceLocations(message, sb.toString()); } } public boolean isIgnoring(IMessage.Kind kind) { return (null != getStreamFor(kind)); } /** * No-op * * @see org.aspectj.bridge.IMessageHandler#isIgnoring(org.aspectj.bridge.IMessage.Kind) * @param kind */ public void dontIgnore(IMessage.Kind kind) { } /** * @return System.err for FAIL, ABORT, ERROR, and WARNING, System.out for INFO if -verbose and WEAVEINFO if -showWeaveInfo. */ protected PrintStream getStreamFor(IMessage.Kind kind) { if (IMessage.WARNING.isSameOrLessThan(kind)) { return System.err; } else if (verbose && IMessage.INFO.equals(kind)) { return System.out; } else if (IMessage.WEAVEINFO.equals(kind)) { return System.out; } else { return null; }
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
} /** * No-op * * @see org.aspectj.bridge.IMessageHandler#ignore(org.aspectj.bridge.IMessage.Kind) * @param kind */ public void ignore(Kind kind) { } } public static class LogModeMessagePrinter extends MessagePrinter { protected final PrintStream logStream; public LogModeMessagePrinter(boolean verbose, PrintStream logStream) { super(verbose); this.logStream = logStream; } protected PrintStream getStreamFor(IMessage.Kind kind) { if (IMessage.WARNING.isSameOrLessThan(kind)) { return logStream; } else if (verbose && IMessage.INFO.equals(kind)) { return logStream; } else if (IMessage.WEAVEINFO.equals(kind)) { return logStream; } else { return null; } } } public static class CommandController {
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
public static String TAG_FILE_OPTION = "-XincrementalFile"; public static String INCREMENTAL_OPTION = "-incremental"; public static long MAX_DELAY = 1000 * 600; public static long DEFAULT_DELAY = 1000 * 5; private static String[][] OPTIONS = new String[][] { new String[] { INCREMENTAL_OPTION }, new String[] { TAG_FILE_OPTION, null } }; private boolean running; private boolean quit; private boolean incremental; private File tagFile; private long fileModTime; private long delay; private boolean buildFresh; public CommandController() { delay = DEFAULT_DELAY; } /** * @param argList read and strip incremental args from this * @param sink IMessageHandler for error messages * @return String[] remainder of args
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
*/ public String[] init(String[] args, IMessageHandler sink) { running = true; if (!LangUtil.isEmpty(args)) { String[][] options = LangUtil.copyStrings(OPTIONS); LangUtil.extractOptions(args, options); incremental = (null != options[0][0]); if (null != options[1][0]) { File file = new File(options[1][1]); if (!file.exists()) { MessageUtil.abort(sink, "tag file does not exist: " + file); } else { tagFile = file; fileModTime = tagFile.lastModified(); } } } return args; } /** * @return true if init(String[]) called but doRepeatCommand has not returned false */ public boolean running() { return running; } public void setDelay(long delay) { if ((delay > -1) && (delay < MAX_DELAY)) { this.delay = delay;
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
} } public boolean incremental() { return (incremental || (null != tagFile)); } public boolean commandLineIncremental() { return incremental; } public void quit() { if (!quit) { quit = true; } } boolean buildFresh() { return buildFresh; } boolean doRepeatCommand(ICommand command) { if (!running) { return false; } boolean result = false; if (quit) { result = false; } else if (incremental) { try { if (buildFresh) {
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
buildFresh = false; } System.out.println(" press enter to recompile, r to rebuild, q to quit: "); System.out.flush(); do { int input = System.in.read(); if ('q' == input) { break; } else if ('r' == input) { buildFresh = true; result = true; } else if (('\n' == input) || ('\r' == input)) { result = true; } } while (!result); System.in.skip(Integer.MAX_VALUE); } catch (IOException e) { result = false; } } else if (null != tagFile) { long curModTime; while (true) { if (!tagFile.exists()) { result = false; break; } else if (fileModTime == (curModTime = tagFile.lastModified())) { fileCheckDelay(); } else {
309,402
Bug 309402 Changes to Main.java
In order to get the AJDT ant integration working, we need a small change to Main.java. We need to be able to pass in a custom org.aspectj.bridge.ICommand object. Currently, the ICommand object is created via reflection. Here is my suggestion: 1. augment the ICommand local variable to being a field 2. add a setter for this field 3. change this: ICommand command = ReflectionFactory.makeCommand(commandName, holder); to this: if (command != null) command = ReflectionFactory.makeCommand(commandName, holder);
verified fixed
b21eb05
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-16T15:18:11Z
2010-04-15T22:20:00Z
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
fileModTime = curModTime; result = true; break; } } } if (!result && running) { running = false; } return result; } protected void fileCheckDelay() { long targetTime = System.currentTimeMillis() + delay; while (targetTime > System.currentTimeMillis()) { if (quit) { return; } try { Thread.sleep(300); } catch (InterruptedException e) { } } } } }
310,704
Bug 310704 Bug in ProgramElement.getCorrespondingType()
Here is the code for the method: public String getCorrespondingType(boolean getFullyQualifiedType) { String returnType = (String) kvpairs.get("returnType"); if (returnType == null) returnType = ""; if (getFullyQualifiedType) { return returnType; } int index = returnType.lastIndexOf("."); if (index != -1) { return returnType.substring(index); } return returnType; } the line: return returnType.substring(index); should be using 'index+1'
resolved fixed
a502da8
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-28T01:05:35Z
2010-04-27T20:26:40Z
asm/src/org/aspectj/asm/internal/ProgramElement.java
/* ******************************************************************* * 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: * Mik Kersten initial implementation * Andy Clement Extensions for better IDE representation * ******************************************************************/ package org.aspectj.asm.internal; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import org.aspectj.asm.AsmManager; import org.aspectj.asm.HierarchyWalker; import org.aspectj.asm.IProgramElement; import org.aspectj.bridge.IMessage; import org.aspectj.bridge.ISourceLocation; /** * @author Mik Kersten */ public class ProgramElement implements IProgramElement {
310,704
Bug 310704 Bug in ProgramElement.getCorrespondingType()
Here is the code for the method: public String getCorrespondingType(boolean getFullyQualifiedType) { String returnType = (String) kvpairs.get("returnType"); if (returnType == null) returnType = ""; if (getFullyQualifiedType) { return returnType; } int index = returnType.lastIndexOf("."); if (index != -1) { return returnType.substring(index); } return returnType; } the line: return returnType.substring(index); should be using 'index+1'
resolved fixed
a502da8
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-28T01:05:35Z
2010-04-27T20:26:40Z
asm/src/org/aspectj/asm/internal/ProgramElement.java
public transient AsmManager asm; private static final long serialVersionUID = 171673495267384449L; public static boolean shortITDNames = true; private final static String UNDEFINED = "<undefined>"; private final static int AccPublic = 0x0001; private final static int AccPrivate = 0x0002; private final static int AccProtected = 0x0004; private final static int AccPrivileged = 0x0006; private final static int AccStatic = 0x0008; private final static int AccFinal = 0x0010; private final static int AccSynchronized = 0x0020; private final static int AccVolatile = 0x0040; private final static int AccTransient = 0x0080; private final static int AccNative = 0x0100; private final static int AccInterface = 0x0200; private final static int AccAbstract = 0x0400; private final static int AccStrictfp = 0x0800; protected String name;
310,704
Bug 310704 Bug in ProgramElement.getCorrespondingType()
Here is the code for the method: public String getCorrespondingType(boolean getFullyQualifiedType) { String returnType = (String) kvpairs.get("returnType"); if (returnType == null) returnType = ""; if (getFullyQualifiedType) { return returnType; } int index = returnType.lastIndexOf("."); if (index != -1) { return returnType.substring(index); } return returnType; } the line: return returnType.substring(index); should be using 'index+1'
resolved fixed
a502da8
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2010-04-28T01:05:35Z
2010-04-27T20:26:40Z
asm/src/org/aspectj/asm/internal/ProgramElement.java
private Kind kind; protected IProgramElement parent = null; protected List children = Collections.EMPTY_LIST; public Map kvpairs = Collections.EMPTY_MAP; protected ISourceLocation sourceLocation = null; public int modifiers; private String handle = null; public AsmManager getModel() { return asm; } public ProgramElement() { int stop = 1; } public ProgramElement(AsmManager asm, String name, Kind kind, List children) { this.asm = asm; if (asm == null && !name.equals("<build to view structure>")) { throw new RuntimeException(); } this.name = name; this.kind = kind; if (children != null) setChildren(children); } public ProgramElement(AsmManager asm, String name, IProgramElement.Kind kind, ISourceLocation sourceLocation, int modifiers, String comment, List children) { this(asm, name, kind, children); this.sourceLocation = sourceLocation;