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
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
IHierarchy model = structureModel.getHierarchy(); String rootLabel = "<root>"; IProgramElement.Kind kind = IProgramElement.Kind.FILE_JAVA; if (buildConfig.getConfigFile() != null) { rootLabel = buildConfig.getConfigFile().getName(); model.setConfigFile(buildConfig.getConfigFile().getAbsolutePath()); kind = IProgramElement.Kind.FILE_LST; } model.setRoot(new ProgramElement(structureModel, rootLabel, kind, new ArrayList())); model.setFileMap(new HashMap()); state.setStructureModel(structureModel); } } } } }
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
} public void setCustomMungerFactory(Object o) { customMungerFactory = (CustomMungerFactory) o; } public Object getCustomMungerFactory() { return customMungerFactory; } private void initBcelWorld(IMessageHandler handler) throws IOException { List cp = buildConfig.getFullClasspath(); BcelWorld bcelWorld = new BcelWorld(cp, handler, null); bcelWorld.setBehaveInJava5Way(buildConfig.getBehaveInJava5Way()); bcelWorld.setAddSerialVerUID(buildConfig.isAddSerialVerUID()); bcelWorld.setXmlConfigured(buildConfig.isXmlConfigured()); bcelWorld.setXmlFiles(buildConfig.getXmlFiles()); bcelWorld.performExtraConfiguration(buildConfig.getXconfigurationInfo()); bcelWorld.setTargetAspectjRuntimeLevel(buildConfig.getTargetAspectjRuntimeLevel()); bcelWorld.setOptionalJoinpoints(buildConfig.getXJoinpoints()); bcelWorld.setXnoInline(buildConfig.isXnoInline()); bcelWorld.setXlazyTjp(buildConfig.isXlazyTjp()); bcelWorld.setXHasMemberSupportEnabled(buildConfig.isXHasMemberEnabled()); bcelWorld.setPinpointMode(buildConfig.isXdevPinpoint()); bcelWorld.setErrorAndWarningThreshold(buildConfig.getOptions().errorThreshold, buildConfig.getOptions().warningThreshold); BcelWeaver bcelWeaver = new BcelWeaver(bcelWorld); bcelWeaver.setCustomMungerFactory(customMungerFactory); state.setWorld(bcelWorld);
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
state.setWeaver(bcelWeaver); state.clearBinarySourceFiles(); if (buildConfig.getLintMode().equals(AjBuildConfig.AJLINT_DEFAULT)) { bcelWorld.getLint().loadDefaultProperties(); } else { bcelWorld.getLint().setAll(buildConfig.getLintMode()); } if (buildConfig.getLintSpecFile() != null) { bcelWorld.getLint().setFromProperties(buildConfig.getLintSpecFile()); } for (Iterator i = buildConfig.getAspectpath().iterator(); i.hasNext();) { File f = (File) i.next(); if (!f.exists()) { IMessage message = new Message("invalid aspectpath entry: " + f.getName(), null, true); handler.handleMessage(message); } else { bcelWeaver.addLibraryJarFile(f); } } File outputDir = buildConfig.getOutputDir(); if (outputDir == null && buildConfig.getCompilationResultDestinationManager() != null) { outputDir = buildConfig.getCompilationResultDestinationManager().getDefaultOutputLocation(); } for (Iterator i = buildConfig.getInJars().iterator(); i.hasNext();) { File inJar = (File) i.next(); List unwovenClasses = bcelWeaver.addJarFile(inJar, outputDir, false);
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
state.recordBinarySource(inJar.getPath(), unwovenClasses); } for (Iterator i = buildConfig.getInpath().iterator(); i.hasNext();) { File inPathElement = (File) i.next(); if (!inPathElement.isDirectory()) { List unwovenClasses = bcelWeaver.addJarFile(inPathElement, outputDir, true); state.recordBinarySource(inPathElement.getPath(), unwovenClasses); } else { File[] binSrcs = FileUtil.listFiles(inPathElement, binarySourceFilter); for (int j = 0; j < binSrcs.length; j++) { UnwovenClassFile ucf = bcelWeaver.addClassFile(binSrcs[j], inPathElement, outputDir); List ucfl = new ArrayList(); ucfl.add(ucf); state.recordBinarySource(binSrcs[j].getPath(), ucfl); } } } bcelWeaver.setReweavableMode(buildConfig.isXNotReweavable()); ResolvedType joinPoint = bcelWorld.resolve("org.aspectj.lang.JoinPoint"); if (joinPoint.isMissing()) { IMessage message = new Message( "classpath error: unable to find org.aspectj.lang.JoinPoint (check that aspectjrt.jar is in your classpath)", null, true); handler.handleMessage(message);
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
} } public World getWorld() { return getBcelWorld(); } void addAspectClassFilesToWeaver(List addedClassFiles) throws IOException { for (Iterator i = addedClassFiles.iterator(); i.hasNext();) { UnwovenClassFile classFile = (UnwovenClassFile) i.next(); getWeaver().addClassFile(classFile); } } public FileSystem getLibraryAccess(String[] classpaths, String[] filenames) { String defaultEncoding = buildConfig.getOptions().defaultEncoding; if ("".equals(defaultEncoding)) { defaultEncoding = null; } return new FileSystem(classpaths, filenames, defaultEncoding, ClasspathLocation.BINARY); } public IProblemFactory getProblemFactory() { return new DefaultProblemFactory(Locale.getDefault()); } /* * Build the set of compilation source units */
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
public CompilationUnit[] getCompilationUnits(String[] filenames) { int fileCount = filenames.length; CompilationUnit[] units = new CompilationUnit[fileCount]; String defaultEncoding = buildConfig.getOptions().defaultEncoding; if ("".equals(defaultEncoding)) { defaultEncoding = null; } for (int i = 0; i < fileCount; i++) { units[i] = new CompilationUnit(null, filenames[i], defaultEncoding); } return units; } public String extractDestinationPathFromSourceFile(CompilationResult result) { ICompilationUnit compilationUnit = result.compilationUnit; if (compilationUnit != null) { char[] fileName = compilationUnit.getFileName(); int lastIndex = CharOperation.lastIndexOf(java.io.File.separatorChar, fileName); if (lastIndex == -1) { return System.getProperty("user.dir"); } return new String(CharOperation.subarray(fileName, 0, lastIndex)); } return System.getProperty("user.dir"); } public void performCompilation(Collection files) { if (progressListener != null) { compiledCount = 0; sourceFileCount = files.size(); progressListener.setText("compiling source files");
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
} String[] filenames = new String[files.size()]; int idx = 0; for (Iterator fIterator = files.iterator(); fIterator.hasNext();) { File f = (File) fIterator.next(); filenames[idx++] = f.getPath(); } environment = state.getNameEnvironment(); boolean environmentNeedsRebuilding = false; if (buildConfig.getChanged() != AjBuildConfig.NO_CHANGES) { environmentNeedsRebuilding = true; } if (environment == null || environmentNeedsRebuilding) { List cps = buildConfig.getFullClasspath(); Dump.saveFullClasspath(cps); String[] classpaths = new String[cps.size()]; for (int i = 0; i < cps.size(); i++) { classpaths[i] = (String) cps.get(i); } environment = new StatefulNameEnvironment(getLibraryAccess(classpaths, filenames), state.getClassNameToFileMap(), state); state.setNameEnvironment(environment); } org.aspectj.ajdt.internal.compiler.CompilerAdapter.setCompilerAdapterFactory(this); org.aspectj.org.eclipse.jdt.internal.compiler.Compiler compiler = new org.aspectj.org.eclipse.jdt.internal.compiler.Compiler( environment, DefaultErrorHandlingPolicies.proceedWithAllProblems(), buildConfig.getOptions().getMap(), getBatchRequestor(), getProblemFactory()); compiler.options.produceReferenceInfo = true; try {
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
compiler.compile(getCompilationUnits(filenames)); } catch (OperationCanceledException oce) { handler.handleMessage(new Message("build cancelled:" + oce.getMessage(), IMessage.WARNING, null, null)); } org.aspectj.ajdt.internal.compiler.CompilerAdapter.setCompilerAdapterFactory(null); AnonymousClassPublisher.aspectOf().setAnonymousClassCreationListener(null); environment.cleanup(); } public void cleanupEnvironment() { if (environment != null) { environment.cleanup(); environment = null; } } /* * Answer the component to which will be handed back compilation results from the compiler */ public IIntermediateResultsRequestor getInterimResultRequestor() { return new IIntermediateResultsRequestor() { public void acceptResult(InterimCompilationResult result) { if (progressListener != null) { compiledCount++; progressListener.setProgress((compiledCount / 2.0) / sourceFileCount); progressListener.setText("compiled: " + result.fileName()); } state.noteResult(result); if (progressListener != null && progressListener.isCancelledRequested()) { throw new AbortCompilation(true, new OperationCanceledException("Compilation cancelled as requested"));
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
} } }; } public ICompilerRequestor getBatchRequestor() { return new ICompilerRequestor() { public void acceptResult(CompilationResult unitResult) { boolean hasErrors = unitResult.hasErrors(); if (!hasErrors || proceedOnError()) { Collection classFiles = unitResult.compiledTypes.values(); boolean shouldAddAspectName = (buildConfig.getOutxmlName() != null); for (Iterator iter = classFiles.iterator(); iter.hasNext();) { ClassFile classFile = (ClassFile) iter.next(); String filename = new String(classFile.fileName()); String classname = filename.replace('/', '.'); filename = filename.replace('/', File.separatorChar) + ".class"; try { if (buildConfig.getOutputJar() == null) { String outfile = writeDirectoryEntry(unitResult, classFile, filename); if (environmentSupportsIncrementalCompilation) { if (!classname.endsWith("$ajcMightHaveAspect")) { ResolvedType type = getBcelWorld().resolve(classname); if (type.isAspect()) { state.recordAspectClassFile(outfile); } } } } else {
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
writeZipEntry(classFile, filename); } if (shouldAddAspectName && !classname.endsWith("$ajcMightHaveAspect")) addAspectName(classname, unitResult.getFileName()); } catch (IOException ex) { IMessage message = EclipseAdapterUtils.makeErrorMessage(new String(unitResult.fileName), CANT_WRITE_RESULT, ex); handler.handleMessage(message); } } state.noteNewResult(unitResult); unitResult.compiledTypes.clear(); } if (unitResult.hasProblems() || unitResult.hasTasks()) { IProblem[] problems = unitResult.getAllProblems(); for (int i = 0; i < problems.length; i++) { IMessage message = EclipseAdapterUtils.makeMessage(unitResult.compilationUnit, problems[i], getBcelWorld()); handler.handleMessage(message); } } } private String writeDirectoryEntry(CompilationResult unitResult, ClassFile classFile, String filename) throws IOException { File destinationPath = buildConfig.getOutputDir(); if (buildConfig.getCompilationResultDestinationManager() != null) { destinationPath = buildConfig.getCompilationResultDestinationManager().getOutputLocationForClass( new File(new String(unitResult.fileName))); } String outFile; if (destinationPath == null) {
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
outFile = new File(filename).getName(); outFile = new File(extractDestinationPathFromSourceFile(unitResult), outFile).getPath(); } else { outFile = new File(destinationPath, filename).getPath(); } BufferedOutputStream os = FileUtil.makeOutputStream(new File(outFile)); os.write(classFile.getBytes()); os.close(); if (buildConfig.getCompilationResultDestinationManager() != null) { buildConfig.getCompilationResultDestinationManager().reportFileWrite(outFile, CompilationResultDestinationManager.FILETYPE_CLASS); } return outFile; } private void writeZipEntry(ClassFile classFile, String name) throws IOException { name = name.replace(File.separatorChar, '/'); ZipEntry newEntry = new ZipEntry(name); zos.putNextEntry(newEntry); zos.write(classFile.getBytes()); zos.closeEntry(); } private void addAspectName(String name, char[] fileContainingAspect) { BcelWorld world = getBcelWorld(); ResolvedType type = world.resolve(name); if (type.isAspect()) { if (state.getAspectNamesToFileNameMap() == null) { state.initializeAspectNamesToFileNameMap(); } if (!state.getAspectNamesToFileNameMap().containsKey(name)) {
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
state.getAspectNamesToFileNameMap().put(name, fileContainingAspect); } } } }; } protected boolean proceedOnError() { return buildConfig.getProceedOnError(); } }
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
} } } private void setBuildConfig(AjBuildConfig buildConfig) { this.buildConfig = buildConfig; if (!this.environmentSupportsIncrementalCompilation) { this.environmentSupportsIncrementalCompilation = (buildConfig.isIncrementalMode() || buildConfig .isIncrementalFileMode()); } handler.reset(); } String makeClasspathString(AjBuildConfig buildConfig) { if (buildConfig == null || buildConfig.getFullClasspath() == null) return ""; StringBuffer buf = new StringBuffer(); boolean first = true; for (Iterator it = buildConfig.getFullClasspath().iterator(); it.hasNext();) {
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
if (first) { first = false; } else { buf.append(File.pathSeparator); } buf.append(it.next().toString()); } return buf.toString(); } /** * This will return null if aspectjrt.jar is present and has the correct version. Otherwise it will return a string message * indicating the problem. */ private String checkRtJar(AjBuildConfig buildConfig) { if (Version.text.equals(Version.DEVELOPMENT)) { return null; } if (buildConfig == null || buildConfig.getFullClasspath() == null) return "no classpath specified"; String ret = null; for (Iterator it = buildConfig.getFullClasspath().iterator(); it.hasNext();) { File p = new File((String) it.next()); if (p.isFile() && p.getName().startsWith("aspectjrt") && p.getName().endsWith(".jar")) { try { String version = null; Manifest manifest = new JarFile(p).getManifest();
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
if (manifest == null) { ret = "no manifest found in " + p.getAbsolutePath() + ", expected " + Version.text; continue; } Attributes attr = manifest.getAttributes("org/aspectj/lang/"); if (null != attr) { version = attr.getValue(Attributes.Name.IMPLEMENTATION_VERSION); if (null != version) { version = version.trim(); } } if (Version.DEVELOPMENT.equals(version)) { return null; } else if (!Version.text.equals(version)) { ret = "bad version number found in " + p.getAbsolutePath() + " expected " + Version.text + " found " + version; continue; } } catch (IOException ioe) { ret = "bad jar file found in " + p.getAbsolutePath() + " error: " + ioe; } return null; } else { } }
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
if (ret != null) return ret; return "couldn't find aspectjrt.jar on classpath, checked: " + makeClasspathString(buildConfig); } public String toString() { StringBuffer buf = new StringBuffer(); buf.append("AjBuildManager("); buf.append(")"); return buf.toString(); } } /** * Returns null if there is no structure model */ public AsmManager getStructureModel() { return (state == null ? null : state.getStructureModel()); } public IProgressListener getProgressListener() { return progressListener; } public void setProgressListener(IProgressListener progressListener) { this.progressListener = progressListener; } /* * (non-Javadoc) * * @see org.aspectj.ajdt.internal.compiler.AjCompiler.IOutputClassFileNameProvider#getOutputClassFileName(char[])
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
*/ public String getOutputClassFileName(char[] eclipseClassFileName, CompilationResult result) { String filename = new String(eclipseClassFileName); filename = filename.replace('/', File.separatorChar) + ".class"; File destinationPath = buildConfig.getOutputDir(); if (buildConfig.getCompilationResultDestinationManager() != null) { File f = new File(new String(result.getFileName())); destinationPath = buildConfig.getCompilationResultDestinationManager().getOutputLocationForClass(f); } String outFile; if (destinationPath == null) { outFile = new File(filename).getName(); outFile = new File(extractDestinationPathFromSourceFile(result), outFile).getPath(); } else { outFile = new File(destinationPath, filename).getPath(); } return outFile; } /* * (non-Javadoc) * * @see org.eclipse.jdt.internal.compiler.ICompilerAdapterFactory#getAdapter(org.eclipse.jdt.internal.compiler.Compiler) */ public ICompilerAdapter getAdapter(org.aspectj.org.eclipse.jdt.internal.compiler.Compiler forCompiler) { populateCompilerOptionsFromLintSettings(forCompiler); AjProblemReporter pr = new AjProblemReporter(DefaultErrorHandlingPolicies.proceedWithAllProblems(), forCompiler.options, getProblemFactory()); forCompiler.problemReporter = pr; AjLookupEnvironment le = new AjLookupEnvironment(forCompiler, forCompiler.options, pr, environment);
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
EclipseFactory factory = new EclipseFactory(le, this); le.factory = factory; pr.factory = factory; forCompiler.lookupEnvironment = le; forCompiler.parser = new Parser(pr, forCompiler.options.parseLiteralExpressionsAsConstants); if (getBcelWorld().shouldPipelineCompilation()) { IMessage message = MessageUtil.info("Pipelining compilation"); handler.handleMessage(message); return new AjPipeliningCompilerAdapter(forCompiler, batchCompile, getBcelWorld(), getWeaver(), factory, getInterimResultRequestor(), progressListener, this, this, state.getBinarySourceMap(), buildConfig.isTerminateAfterCompilation(), buildConfig.getProceedOnError(), buildConfig.isNoAtAspectJAnnotationProcessing(), state); } else { return new AjCompilerAdapter(forCompiler, batchCompile, getBcelWorld(), getWeaver(), factory, getInterimResultRequestor(), progressListener, this, this, state.getBinarySourceMap(), buildConfig.isTerminateAfterCompilation(), buildConfig.getProceedOnError(), buildConfig.isNoAtAspectJAnnotationProcessing(), state); } } /** * Some AspectJ lint options need to be known about in the compiler. This is how we pass them over... * * @param forCompiler */ private void populateCompilerOptionsFromLintSettings(org.aspectj.org.eclipse.jdt.internal.compiler.Compiler forCompiler) { BcelWorld world = this.state.getBcelWorld();
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
IMessage.Kind swallowedExceptionKind = world.getLint().swallowedExceptionInCatchBlock.getKind(); Map optionsMap = new HashMap(); optionsMap.put(CompilerOptions.OPTION_ReportSwallowedExceptionInCatchBlock, swallowedExceptionKind == null ? "ignore" : swallowedExceptionKind.toString()); forCompiler.options.set(optionsMap); } /* * (non-Javadoc) * * @see org.aspectj.ajdt.internal.compiler.IBinarySourceProvider#getBinarySourcesForThisWeave() */ public Map getBinarySourcesForThisWeave() { return binarySourcesForTheNextCompile; } public static AsmHierarchyBuilder getAsmHierarchyBuilder() { return asmHierarchyBuilder; } /** * Override the the default hierarchy builder. */ public static void setAsmHierarchyBuilder(AsmHierarchyBuilder newBuilder) { asmHierarchyBuilder = newBuilder; } public AjState getState() { return state; } public void setState(AjState buildState) { state = buildState; } private static class AjBuildContexFormatter implements ContextFormatter {
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
public String formatEntry(int phaseId, Object data) { StringBuffer sb = new StringBuffer(); if (phaseId == CompilationAndWeavingContext.BATCH_BUILD) { sb.append("batch building "); } else { sb.append("incrementally building "); } AjBuildConfig config = (AjBuildConfig) data; List classpath = config.getClasspath(); sb.append("with classpath: "); for (Iterator iter = classpath.iterator(); iter.hasNext();) { sb.append(iter.next().toString()); sb.append(File.pathSeparator); } return sb.toString(); } } public boolean wasFullBuild() { return wasFullBuild; } }
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java
/* ******************************************************************* * Copyright (c) 1999-2001 Xerox Corporation, * 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.core.builder; import java.io.File; import org.aspectj.bridge.IMessage; import org.aspectj.bridge.ISourceLocation; import org.aspectj.bridge.Message; import org.aspectj.bridge.SourceLocation; import org.aspectj.org.eclipse.jdt.core.compiler.IProblem; import org.aspectj.org.eclipse.jdt.internal.compiler.env.ICompilationUnit; import org.aspectj.weaver.LintMessage; import org.aspectj.weaver.World; public class EclipseAdapterUtils {
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java
public static String makeLocationContext(ICompilationUnit compilationUnit, IProblem problem) { int startPosition = problem.getSourceStart(); int endPosition = problem.getSourceEnd(); if ((startPosition > endPosition) || ((startPosition <= 0) && (endPosition <= 0)) || compilationUnit == null)
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java
return "(no source information available)"; final char SPACE = '\u0020'; final char MARK = '^'; final char TAB = '\t'; char[] source = compilationUnit.getContents(); int begin = startPosition >= source.length ? source.length - 1 : startPosition; if (begin == -1) return "(no source information available)"; int relativeStart = 0; int end = endPosition >= source.length ? source.length - 1 : endPosition; int relativeEnd = 0; label: for (relativeStart = 0;; relativeStart++) { if (begin == 0) break label; if ((source[begin - 1] == '\n') || (source[begin - 1] == '\r')) break label; begin--; } label: for (relativeEnd = 0;; relativeEnd++) { if ((end + 1) >= source.length) break label; if ((source[end + 1] == '\r') || (source[end + 1] == '\n')) { break label; } end++;
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java
} char[] extract = new char[end - begin + 1]; System.arraycopy(source, begin, extract, 0, extract.length); char c; int trimLeftIndex = 0; while ((((c = extract[trimLeftIndex++]) == TAB) || (c == SPACE)) && trimLeftIndex < extract.length) { } if (trimLeftIndex >= extract.length) return new String(extract) + "\n"; System.arraycopy(extract, trimLeftIndex - 1, extract = new char[extract.length - trimLeftIndex + 1], 0, extract.length); relativeStart -= trimLeftIndex; int pos = 0; char[] underneath = new char[extract.length]; for (int i = 0; i <= relativeStart; i++) { if (extract[i] == TAB) { underneath[pos++] = TAB; } else { underneath[pos++] = SPACE; } } for (int i = startPosition + trimLeftIndex; i <= (endPosition >= source.length ? source.length - 1 : endPosition); i++) underneath[pos++] = MARK; System.arraycopy(underneath, 0, underneath = new char[pos], 0, pos); return new String(extract) + "\n" + new String(underneath);
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java
} /** * Extract source location file, start and end lines, and context. Column is not extracted correctly. * * @return ISourceLocation with correct file and lines but not column. */ public static ISourceLocation makeSourceLocation(ICompilationUnit unit, IProblem problem) { int line = problem.getSourceLineNumber(); File file = new File(new String(problem.getOriginatingFileName())); String context = makeLocationContext(unit, problem); return new SourceLocation(file, line, line, 0, context); } /** * Extract message text and source location, including context. * * @param world */ public static IMessage makeMessage(ICompilationUnit unit, IProblem problem, World world) { ISourceLocation sourceLocation = makeSourceLocation(unit, problem); IProblem[] seeAlso = problem.seeAlso(); int validPlaces = 0; for (int ii = 0; ii < seeAlso.length; ii++) { if (seeAlso[ii].getSourceLineNumber() >= 0) validPlaces++; } ISourceLocation[] seeAlsoLocations = new ISourceLocation[validPlaces]; int pos = 0;
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java
for (int i = 0; i < seeAlso.length; i++) { if (seeAlso[i].getSourceLineNumber() >= 0) { seeAlsoLocations[pos++] = new SourceLocation(new File(new String(seeAlso[i].getOriginatingFileName())), seeAlso[i] .getSourceLineNumber()); } } String extraDetails = problem.getSupplementaryMessageInfo(); boolean declared = false; boolean isLintMessage = false; String lintkey = null; if (extraDetails != null && extraDetails.endsWith("[deow=true]")) { declared = true; extraDetails = extraDetails.substring(0, extraDetails.length() - "[deow=true]".length()); } if (extraDetails != null && extraDetails.indexOf("[Xlint:") != -1) { isLintMessage = true; lintkey = extraDetails.substring(extraDetails.indexOf("[Xlint:")); lintkey = lintkey.substring("[Xlint:".length()); lintkey = lintkey.substring(0, lintkey.indexOf("]")); } IMessage.Kind kind; if (problem.getID() == IProblem.Task) { kind = IMessage.TASKTAG; } else {
269,912
Bug 269912 wasted time building message context when it is only used for command line builds
The context for a message is created even when AspectJ is used inside AJDT - but the context only ever gets used when printing messages to System.out. Under AJDT we ought to be able to 'switch it off'
resolved fixed
c732808
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-25T16:19:48Z
2009-03-25T00:13:20Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseAdapterUtils.java
if (problem.isError()) { kind = IMessage.ERROR; } else { kind = IMessage.WARNING; } } IMessage msg = null; if (isLintMessage) { msg = new LintMessage(problem.getMessage(), extraDetails, world.getLint().fromKey(lintkey), kind, sourceLocation, null, seeAlsoLocations, declared, problem.getID(), problem.getSourceStart(), problem.getSourceEnd()); } else { msg = new Message(problem.getMessage(), extraDetails, kind, sourceLocation, null, seeAlsoLocations, declared, problem .getID(), problem.getSourceStart(), problem.getSourceEnd()); } return msg; } public static IMessage makeErrorMessage(ICompilationUnit unit, String text, Exception ex) { ISourceLocation loc = new SourceLocation(new File(new String(unit.getFileName())), 0, 0, 0, ""); IMessage msg = new Message(text, IMessage.ERROR, ex, loc); return msg; } public static IMessage makeErrorMessage(String srcFile, String text, Exception ex) { ISourceLocation loc = new SourceLocation(new File(srcFile), 0, 0, 0, ""); IMessage msg = new Message(text, IMessage.ERROR, ex, loc); return msg; } private EclipseAdapterUtils() { } }
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.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.weaver.model; import java.io.File; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Collection; import java.util.Collections;
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
import java.util.Iterator; import java.util.List; import org.aspectj.asm.AsmManager; import org.aspectj.asm.IHierarchy; import org.aspectj.asm.IProgramElement; import org.aspectj.asm.IRelationship; import org.aspectj.asm.IRelationshipMap; import org.aspectj.asm.internal.ProgramElement; import org.aspectj.bridge.ISourceLocation; import org.aspectj.bridge.SourceLocation; import org.aspectj.weaver.Advice; import org.aspectj.weaver.AdviceKind; import org.aspectj.weaver.Checker; import org.aspectj.weaver.Lint; import org.aspectj.weaver.Member; import org.aspectj.weaver.ReferenceType; import org.aspectj.weaver.ResolvedMember; import org.aspectj.weaver.ResolvedPointcutDefinition; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.ResolvedTypeMunger; import org.aspectj.weaver.Shadow; import org.aspectj.weaver.ShadowMunger; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.World; import org.aspectj.weaver.bcel.BcelShadow; import org.aspectj.weaver.bcel.BcelTypeMunger; import org.aspectj.weaver.patterns.DeclareErrorOrWarning; import org.aspectj.weaver.patterns.DeclareParents; import org.aspectj.weaver.patterns.Pointcut; public class AsmRelationshipProvider {
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
public static final String ADVISES = "advises"; public static final String ADVISED_BY = "advised by"; public static final String DECLARES_ON = "declares on"; public static final String DECLAREDY_BY = "declared by"; public static final String SOFTENS = "softens"; public static final String SOFTENED_BY = "softened by"; public static final String MATCHED_BY = "matched by"; public static final String MATCHES_DECLARE = "matches declare"; public static final String INTER_TYPE_DECLARES = "declared on"; public static final String INTER_TYPE_DECLARED_BY = "aspect declarations"; public static final String ANNOTATES = "annotates"; public static final String ANNOTATED_BY = "annotated by"; /** * Add a relationship for a declare error or declare warning */ public static void addDeclareErrorOrWarningRelationship(AsmManager model, Shadow affectedShadow, Checker deow) { if (model == null) { return; } if (affectedShadow.getSourceLocation() == null || deow.getSourceLocation() == null) { return; } if (World.createInjarHierarchy) { createHierarchyForBinaryAspect(model, deow); } IProgramElement targetNode = getNode(model, affectedShadow); if (targetNode == null) { return; } String targetHandle = model.getHandleProvider().createHandleIdentifier(targetNode);
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
if (targetHandle == null) { return; } IProgramElement sourceNode = model.getHierarchy().findElementForSourceLine(deow.getSourceLocation()); String sourceHandle = model.getHandleProvider().createHandleIdentifier(sourceNode); if (sourceHandle == null) { return; } IRelationshipMap relmap = model.getRelationshipMap(); IRelationship foreward = relmap.get(sourceHandle, IRelationship.Kind.DECLARE, MATCHED_BY, false, true); foreward.addTarget(targetHandle); IRelationship back = relmap.get(targetHandle, IRelationship.Kind.DECLARE, MATCHES_DECLARE, false, true); if (back != null && back.getTargets() != null) { back.addTarget(sourceHandle); } if (sourceNode.getSourceLocation() != null) { model.addAspectInEffectThisBuild(sourceNode.getSourceLocation().getSourceFile()); } } /** * Add a relationship for a type transformation (declare parents, intertype method declaration, declare annotation on type). */ public static void addRelationship(AsmManager model, ResolvedType onType, ResolvedTypeMunger typeTransformer, ResolvedType originatingAspect) { if (model == null) { return; } if (World.createInjarHierarchy && isBinaryAspect(originatingAspect)) { createHierarchy(model, typeTransformer, originatingAspect); }
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
if (originatingAspect.getSourceLocation() != null) { String sourceHandle = ""; IProgramElement sourceNode = null; if (typeTransformer.getSourceLocation() != null && typeTransformer.getSourceLocation().getOffset() != -1) { sourceNode = model.getHierarchy().findElementForType(originatingAspect.getPackageName(), originatingAspect.getClassName()); IProgramElement closer = model.getHierarchy().findCloserMatchForLineNumber(sourceNode, typeTransformer.getSourceLocation().getLine()); if (closer != null) { sourceNode = closer; } sourceHandle = model.getHandleProvider().createHandleIdentifier(sourceNode); } else { sourceNode = model.getHierarchy().findElementForType(originatingAspect.getPackageName(), originatingAspect.getClassName()); sourceHandle = model.getHandleProvider().createHandleIdentifier(sourceNode); } if (sourceHandle == null)
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
return; IProgramElement targetNode = model.getHierarchy().findElementForSourceLine(onType.getSourceLocation()); String targetHandle = model.getHandleProvider().createHandleIdentifier(targetNode); if (targetHandle == null) return; IRelationshipMap mapper = model.getRelationshipMap(); IRelationship foreward = mapper.get(sourceHandle, IRelationship.Kind.DECLARE_INTER_TYPE, INTER_TYPE_DECLARES, false, true); foreward.addTarget(targetHandle); IRelationship back = mapper.get(targetHandle, IRelationship.Kind.DECLARE_INTER_TYPE, INTER_TYPE_DECLARED_BY, false, true); back.addTarget(sourceHandle); model.addAspectInEffectThisBuild(sourceNode.getSourceLocation().getSourceFile()); } } private static boolean isBinaryAspect(ResolvedType aspect) { return aspect.getBinaryPath() != null; } /** * Returns the binarySourceLocation for the given sourcelocation. This isn't cached because it's used when faulting in the * binary nodes and is called with ISourceLocations for all advice, pointcuts and deows contained within the * resolvedDeclaringAspect. */ private static ISourceLocation getBinarySourceLocation(ResolvedType aspect, ISourceLocation sl) { if (sl == null) { return null; } String sourceFileName = null; if (aspect instanceof ReferenceType) { String s = ((ReferenceType) aspect).getDelegate().getSourcefilename();
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
int i = s.lastIndexOf('/'); if (i != -1) { sourceFileName = s.substring(i + 1); } else { sourceFileName = s; } } ISourceLocation sLoc = new SourceLocation(getBinaryFile(aspect), sl.getLine(), sl.getEndLine(), ((sl.getColumn() == 0) ? ISourceLocation.NO_COLUMN : sl.getColumn()), sl.getContext(), sourceFileName); return sLoc; } private static ISourceLocation createSourceLocation(String sourcefilename, ResolvedType aspect, ISourceLocation sl) { ISourceLocation sLoc = new SourceLocation(getBinaryFile(aspect), sl.getLine(), sl.getEndLine(), ((sl.getColumn() == 0) ? ISourceLocation.NO_COLUMN : sl.getColumn()), sl.getContext(), sourcefilename); return sLoc; } private static String getSourceFileName(ResolvedType aspect) { String sourceFileName = null; if (aspect instanceof ReferenceType) { String s = ((ReferenceType) aspect).getDelegate().getSourcefilename(); int i = s.lastIndexOf('/'); if (i != -1) { sourceFileName = s.substring(i + 1); } else { sourceFileName = s; } } return sourceFileName; } /**
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
* Returns the File with pathname to the class file, for example either C:\temp * \ajcSandbox\workspace\ajcTest16957.tmp\simple.jar!pkg\BinaryAspect.class if the class file is in a jar file, or * C:\temp\ajcSandbox\workspace\ajcTest16957.tmp!pkg\BinaryAspect.class if the class file is in a directory */ private static File getBinaryFile(ResolvedType aspect) { String s = aspect.getBinaryPath(); File f = aspect.getSourceLocation().getSourceFile(); int i = f.getPath().lastIndexOf('.'); String path = null; if (i != -1) { path = f.getPath().substring(0, i) + ".class"; } else { path = f.getPath() + ".class"; } return new File(s + "!" + path); } /** * Create a basic hierarchy to represent an aspect only available in binary (from the aspectpath). */ private static void createHierarchy(AsmManager model, ResolvedTypeMunger typeTransformer, ResolvedType aspect) { IProgramElement filenode = model.getHierarchy().findElementForSourceLine(typeTransformer.getSourceLocation());
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
if (!filenode.getKind().equals(IProgramElement.Kind.FILE_JAVA)) { return; } IProgramElement classFileNode = new ProgramElement(model, filenode.getName(), IProgramElement.Kind.FILE, getBinarySourceLocation(aspect, aspect.getSourceLocation()), 0, null, null); IProgramElement root = model.getHierarchy().getRoot(); IProgramElement binaries = model.getHierarchy().findElementForLabel(root, IProgramElement.Kind.SOURCE_FOLDER, "binaries"); if (binaries == null) { binaries = new ProgramElement(model, "binaries", IProgramElement.Kind.SOURCE_FOLDER, new ArrayList()); root.addChild(binaries); } String packagename = aspect.getPackageName() == null ? "" : aspect.getPackageName(); IProgramElement pkgNode = model.getHierarchy().findElementForLabel(binaries, IProgramElement.Kind.PACKAGE, packagename); if (pkgNode == null) { pkgNode = new ProgramElement(model, packagename, IProgramElement.Kind.PACKAGE, new ArrayList()); binaries.addChild(pkgNode); pkgNode.addChild(classFileNode); } else {
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
pkgNode.addChild(classFileNode); for (Iterator iter = pkgNode.getChildren().iterator(); iter.hasNext();) { IProgramElement element = (IProgramElement) iter.next(); if (!element.equals(classFileNode) && element.getHandleIdentifier().equals(classFileNode.getHandleIdentifier())) { pkgNode.removeChild(classFileNode); return; } } }
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
IProgramElement aspectNode = new ProgramElement(model, aspect.getSimpleName(), IProgramElement.Kind.ASPECT, getBinarySourceLocation(aspect, aspect.getSourceLocation()), aspect.getModifiers(), null, null); classFileNode.addChild(aspectNode); addChildNodes(model, aspect, aspectNode, aspect.getDeclaredPointcuts()); addChildNodes(model, aspect, aspectNode, aspect.getDeclaredAdvice()); addChildNodes(model, aspect, aspectNode, aspect.getDeclares()); addChildNodes(model, aspect, aspectNode, aspect.getTypeMungers()); } /** * Adds a declare annotation relationship, sometimes entities don't have source locs (methods/fields) so use other variants of * this method if that is the case as they will look the entities up in the structure model. */ public static void addDeclareAnnotationRelationship(AsmManager model, ISourceLocation declareAnnotationLocation, ISourceLocation annotatedLocation) { if (model == null) { return; } IProgramElement sourceNode = model.getHierarchy().findElementForSourceLine(declareAnnotationLocation); String sourceHandle = model.getHandleProvider().createHandleIdentifier(sourceNode); if (sourceHandle == null) { return; } IProgramElement targetNode = model.getHierarchy().findElementForSourceLine(annotatedLocation); String targetHandle = model.getHandleProvider().createHandleIdentifier(targetNode); if (targetHandle == null) {
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
return; } IRelationshipMap mapper = model.getRelationshipMap(); IRelationship foreward = mapper.get(sourceHandle, IRelationship.Kind.DECLARE_INTER_TYPE, ANNOTATES, false, true); foreward.addTarget(targetHandle); IRelationship back = mapper.get(targetHandle, IRelationship.Kind.DECLARE_INTER_TYPE, ANNOTATED_BY, false, true); back.addTarget(sourceHandle); if (sourceNode.getSourceLocation() != null) { model.addAspectInEffectThisBuild(sourceNode.getSourceLocation().getSourceFile()); } } /** * Creates the hierarchy for binary aspects */ public static void createHierarchyForBinaryAspect(AsmManager asm, ShadowMunger munger) { if (!munger.isBinary()) { return; } IProgramElement sourceFileNode = asm.getHierarchy().findElementForSourceLine(munger.getSourceLocation()); if (!sourceFileNode.getKind().equals(IProgramElement.Kind.FILE_JAVA)) { return; } ResolvedType aspect = munger.getDeclaringType();
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
IProgramElement classFileNode = new ProgramElement(asm, sourceFileNode.getName(), IProgramElement.Kind.FILE, munger .getBinarySourceLocation(aspect.getSourceLocation()), 0, null, null); IProgramElement root = asm.getHierarchy().getRoot(); IProgramElement binaries = asm.getHierarchy().findElementForLabel(root, IProgramElement.Kind.SOURCE_FOLDER, "binaries"); if (binaries == null) { binaries = new ProgramElement(asm, "binaries", IProgramElement.Kind.SOURCE_FOLDER, new ArrayList()); root.addChild(binaries); } String packagename = aspect.getPackageName() == null ? "" : aspect.getPackageName(); IProgramElement pkgNode = asm.getHierarchy().findElementForLabel(binaries, IProgramElement.Kind.PACKAGE, packagename); if (pkgNode == null) { pkgNode = new ProgramElement(asm, packagename, IProgramElement.Kind.PACKAGE, new ArrayList()); binaries.addChild(pkgNode); pkgNode.addChild(classFileNode); } else { pkgNode.addChild(classFileNode); for (Iterator iter = pkgNode.getChildren().iterator(); iter.hasNext();) { IProgramElement element = (IProgramElement) iter.next(); if (!element.equals(classFileNode) && element.getHandleIdentifier().equals(classFileNode.getHandleIdentifier())) { pkgNode.removeChild(classFileNode); return;
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
} } } IProgramElement aspectNode = new ProgramElement(asm, aspect.getSimpleName(), IProgramElement.Kind.ASPECT, munger .getBinarySourceLocation(aspect.getSourceLocation()), aspect.getModifiers(), null, null); classFileNode.addChild(aspectNode); String sourcefilename = getSourceFileName(aspect);
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
addPointcuts(asm, sourcefilename, aspect, aspectNode, aspect.getDeclaredPointcuts()); addChildNodes(asm, aspect, aspectNode, aspect.getDeclaredAdvice()); addChildNodes(asm, aspect, aspectNode, aspect.getDeclares()); addChildNodes(asm, aspect, aspectNode, aspect.getTypeMungers()); } private static void addPointcuts(AsmManager model, String sourcefilename, ResolvedType aspect, IProgramElement containingAspect, ResolvedMember[] pointcuts) { for (int i = 0; i < pointcuts.length; i++) { ResolvedMember pointcut = pointcuts[i]; if (pointcut instanceof ResolvedPointcutDefinition) { ResolvedPointcutDefinition rpcd = (ResolvedPointcutDefinition) pointcut; Pointcut p = rpcd.getPointcut(); ISourceLocation sLoc = (p == null ? null : p.getSourceLocation()); if (sLoc == null) { sLoc = rpcd.getSourceLocation(); } ISourceLocation pointcutLocation = createSourceLocation(sourcefilename, aspect, sLoc); ProgramElement pointcutElement = new ProgramElement(model, pointcut.getName(), IProgramElement.Kind.POINTCUT, pointcutLocation, pointcut.getModifiers(), NO_COMMENT, Collections.EMPTY_LIST); containingAspect.addChild(pointcutElement); } } } private static final String NO_COMMENT = null; private static void addChildNodes(AsmManager asm, ResolvedType aspect, IProgramElement parent, ResolvedMember[] children) { for (int i = 0; i < children.length; i++) { ResolvedMember pcd = children[i]; if (pcd instanceof ResolvedPointcutDefinition) { ResolvedPointcutDefinition rpcd = (ResolvedPointcutDefinition) pcd; Pointcut p = rpcd.getPointcut();
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
ISourceLocation sLoc = (p == null ? null : p.getSourceLocation()); if (sLoc == null) { sLoc = rpcd.getSourceLocation(); } parent.addChild(new ProgramElement(asm, pcd.getName(), IProgramElement.Kind.POINTCUT, getBinarySourceLocation( aspect, sLoc), pcd.getModifiers(), null, Collections.EMPTY_LIST)); } } } private static void addChildNodes(AsmManager asm, ResolvedType aspect, IProgramElement parent, Collection children) { int deCtr = 1; int dwCtr = 1; for (Iterator iter = children.iterator(); iter.hasNext();) { Object element = iter.next(); if (element instanceof DeclareErrorOrWarning) { DeclareErrorOrWarning decl = (DeclareErrorOrWarning) element; int counter = 0; if (decl.isError()) { counter = deCtr++; } else { counter = dwCtr++; } parent.addChild(createDeclareErrorOrWarningChild(asm, aspect, decl, counter)); } else if (element instanceof Advice) { Advice advice = (Advice) element; parent.addChild(createAdviceChild(asm, advice)); } else if (element instanceof DeclareParents) { parent.addChild(createDeclareParentsChild(asm, (DeclareParents) element)); } else if (element instanceof BcelTypeMunger) { parent.addChild(createIntertypeDeclaredChild(asm, aspect, (BcelTypeMunger) element));
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
} } } private static IProgramElement createDeclareErrorOrWarningChild(AsmManager model, ResolvedType aspect, DeclareErrorOrWarning decl, int count) { IProgramElement deowNode = new ProgramElement(model, decl.getName(), decl.isError() ? IProgramElement.Kind.DECLARE_ERROR : IProgramElement.Kind.DECLARE_WARNING, getBinarySourceLocation(aspect, decl.getSourceLocation()), decl .getDeclaringType().getModifiers(), null, null); deowNode.setDetails("\"" + AsmRelationshipUtils.genDeclareMessage(decl.getMessage()) + "\""); if (count != -1) { deowNode.setBytecodeName(decl.getName() + "_" + count); } return deowNode; } private static IProgramElement createAdviceChild(AsmManager model, Advice advice) {
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
IProgramElement adviceNode = new ProgramElement(model, advice.getKind().getName(), IProgramElement.Kind.ADVICE, advice .getBinarySourceLocation(advice.getSourceLocation()), advice.getSignature().getModifiers(), null, Collections.EMPTY_LIST); adviceNode.setDetails(AsmRelationshipUtils.genPointcutDetails(advice.getPointcut())); adviceNode.setBytecodeName(advice.getSignature().getName()); return adviceNode; } /** * Half baked implementation - will need completing if we go down this route rather than replacing it all for binary aspects. * Doesn't attempt to get parameter names correct - they may have been lost during (de)serialization of the munger, but the * member could still be located so they might be retrievable. */ private static IProgramElement createIntertypeDeclaredChild(AsmManager model, ResolvedType aspect, BcelTypeMunger itd) { ResolvedTypeMunger rtMunger = itd.getMunger(); ResolvedMember sig = rtMunger.getSignature(); if (rtMunger.getKind() == ResolvedTypeMunger.Field) { String name = sig.getDeclaringType().getClassName() + "." + sig.getName(); if (name.indexOf("$") != -1) { name = name.substring(name.indexOf("$") + 1); } IProgramElement pe = new ProgramElement(model, name, IProgramElement.Kind.INTER_TYPE_FIELD, getBinarySourceLocation( aspect, itd.getSourceLocation()), rtMunger.getSignature().getModifiers(), null, Collections.EMPTY_LIST); pe.setCorrespondingType(sig.getReturnType().getName()); return pe; } else if (rtMunger.getKind() == ResolvedTypeMunger.Method) { String name = sig.getDeclaringType().getClassName() + "." + sig.getName(); if (name.indexOf("$") != -1) { name = name.substring(name.indexOf("$") + 1);
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
} IProgramElement pe = new ProgramElement(model, name, IProgramElement.Kind.INTER_TYPE_METHOD, getBinarySourceLocation( aspect, itd.getSourceLocation()), rtMunger.getSignature().getModifiers(), null, Collections.EMPTY_LIST); setParams(pe, sig); return pe; } else if (rtMunger.getKind() == ResolvedTypeMunger.Constructor) { String name = sig.getDeclaringType().getClassName() + "." + sig.getDeclaringType().getClassName(); if (name.indexOf("$") != -1) { name = name.substring(name.indexOf("$") + 1); } IProgramElement pe = new ProgramElement(model, name, IProgramElement.Kind.INTER_TYPE_CONSTRUCTOR, getBinarySourceLocation(aspect, itd.getSourceLocation()), rtMunger.getSignature().getModifiers(), null, Collections.EMPTY_LIST); setParams(pe, sig); return pe; } return null; } private static void setParams(IProgramElement pe, ResolvedMember sig) { UnresolvedType[] ts = sig.getParameterTypes(); pe.setParameterNames(Collections.EMPTY_LIST); String[] pnames = sig.getParameterNames(); if (ts == null) { pe.setParameterSignatures(Collections.EMPTY_LIST, Collections.EMPTY_LIST); } else { List paramSigs = new ArrayList(); List paramNames = new ArrayList(); for (int i = 0; i < ts.length; i++) {
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
paramSigs.add(ts[i].getSignature().toCharArray()); } pe.setParameterSignatures(paramSigs, Collections.EMPTY_LIST); } pe.setCorrespondingType(sig.getReturnType().getName()); } private static IProgramElement createDeclareParentsChild(AsmManager model, DeclareParents decp) { IProgramElement decpElement = new ProgramElement(model, "declare parents", IProgramElement.Kind.DECLARE_PARENTS, getBinarySourceLocation(decp.getDeclaringType(), decp.getSourceLocation()), Modifier.PUBLIC, null, Collections.EMPTY_LIST); return decpElement; } public static String getHandle(AsmManager asm, Advice advice) { if (null == advice.handle) { ISourceLocation sl = advice.getSourceLocation(); if (sl != null) { IProgramElement ipe = asm.getHierarchy().findElementForSourceLine(sl); advice.handle = asm.getHandleProvider().createHandleIdentifier(ipe); } } return advice.handle; } public static void addAdvisedRelationship(AsmManager model, Shadow matchedShadow, ShadowMunger munger) { if (model == null) { return; } if (munger instanceof Advice) { Advice advice = (Advice) munger;
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
if (advice.getKind().isPerEntry() || advice.getKind().isCflow()) { return; } if (World.createInjarHierarchy) { createHierarchyForBinaryAspect(model, advice); } IRelationshipMap mapper = model.getRelationshipMap(); IProgramElement targetNode = getNode(model, matchedShadow); if (targetNode == null) { return; } boolean runtimeTest = advice.hasDynamicTests(); IProgramElement.ExtraInformation extra = new IProgramElement.ExtraInformation(); String adviceHandle = getHandle(model, advice); if (adviceHandle == null) { return; } extra.setExtraAdviceInformation(advice.getKind().getName()); IProgramElement adviceElement = model.getHierarchy().findElementForHandle(adviceHandle); if (adviceElement != null) { adviceElement.setExtraInfo(extra); } String targetHandle = targetNode.getHandleIdentifier(); if (advice.getKind().equals(AdviceKind.Softener)) { IRelationship foreward = mapper.get(adviceHandle, IRelationship.Kind.DECLARE_SOFT, SOFTENS, runtimeTest, true); if (foreward != null) { foreward.addTarget(targetHandle); } IRelationship back = mapper.get(targetHandle, IRelationship.Kind.DECLARE, SOFTENED_BY, runtimeTest, true);
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
if (back != null) { back.addTarget(adviceHandle); } } else { IRelationship foreward = mapper.get(adviceHandle, IRelationship.Kind.ADVICE, ADVISES, runtimeTest, true); if (foreward != null) { foreward.addTarget(targetHandle); } IRelationship back = mapper.get(targetHandle, IRelationship.Kind.ADVICE, ADVISED_BY, runtimeTest, true); if (back != null) { back.addTarget(adviceHandle); } } if (adviceElement.getSourceLocation() != null) { model.addAspectInEffectThisBuild(adviceElement.getSourceLocation().getSourceFile()); } } } protected static IProgramElement getNode(AsmManager model, Shadow shadow) { Member enclosingMember = shadow.getEnclosingCodeSignature();
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
IProgramElement enclosingNode = null; if (shadow instanceof BcelShadow) { Member actualEnclosingMember = ((BcelShadow) shadow).getRealEnclosingCodeSignature(); if (actualEnclosingMember == null) { enclosingNode = lookupMember(model.getHierarchy(), shadow.getEnclosingType(), enclosingMember); } else { UnresolvedType type = enclosingMember.getDeclaringType(); UnresolvedType actualType = actualEnclosingMember.getDeclaringType(); if (type.equals(actualType)) { enclosingNode = lookupMember(model.getHierarchy(), shadow.getEnclosingType(), enclosingMember); } else { enclosingNode = lookupMember(model.getHierarchy(), shadow.getEnclosingType(), actualEnclosingMember); } } } else { enclosingNode = lookupMember(model.getHierarchy(), shadow.getEnclosingType(), enclosingMember); } if (enclosingNode == null) { Lint.Kind err = shadow.getIWorld().getLint().shadowNotInStructure; if (err.isEnabled()) { err.signal(shadow.toString(), shadow.getSourceLocation()); } return null;
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
} Member shadowSig = shadow.getSignature(); if (shadow.getKind() == Shadow.MethodCall || shadow.getKind() == Shadow.ConstructorCall || !shadowSig.equals(enclosingMember)) { IProgramElement bodyNode = findOrCreateCodeNode(model, enclosingNode, shadowSig, shadow); return bodyNode; } else { return enclosingNode; } } private static boolean sourceLinesMatch(ISourceLocation location1, ISourceLocation location2) { return (location1.getLine() == location2.getLine()); } /** * Finds or creates a code IProgramElement for the given shadow. * * The byteCodeName of the created node is set to 'shadowSig.getName() + "!" + counter', eg "println!3". The counter is the * occurence count of children within the enclosingNode which have the same name. So, for example, if a method contains two * System.out.println statements, the first one will have byteCodeName 'println!1' and the second will have byteCodeName * 'println!2'. This is to ensure the two nodes have unique handles when the handles do not depend on sourcelocations. * * Currently the shadows are examined in the sequence they appear in the source file. This means that the counters are * consistent over incremental builds. All aspects are compiled up front and any new aspect created will force a full build. * Moreover, if the body of the enclosingShadow is changed, then the model for this is rebuilt from scratch. */ private static IProgramElement findOrCreateCodeNode(AsmManager asm, IProgramElement enclosingNode, Member shadowSig, Shadow shadow) { for (Iterator it = enclosingNode.getChildren().iterator(); it.hasNext();) { IProgramElement node = (IProgramElement) it.next();
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
int excl = node.getBytecodeName().lastIndexOf('!'); if (((excl != -1 && shadowSig.getName().equals(node.getBytecodeName().substring(0, excl))) || shadowSig.getName() .equals(node.getBytecodeName())) && shadowSig.getSignature().equals(node.getBytecodeSignature()) && sourceLinesMatch(node.getSourceLocation(), shadow.getSourceLocation())) { return node; } } ISourceLocation sl = shadow.getSourceLocation(); SourceLocation peLoc = new SourceLocation(enclosingNode.getSourceLocation().getSourceFile(), sl.getLine()); peLoc.setOffset(sl.getOffset()); IProgramElement peNode = new ProgramElement(asm, shadow.toString(), IProgramElement.Kind.CODE, peLoc, 0, null, null); int numberOfChildrenWithThisName = 0; for (Iterator it = enclosingNode.getChildren().iterator(); it.hasNext();) { IProgramElement child = (IProgramElement) it.next(); if (child.getName().equals(shadow.toString())) { numberOfChildrenWithThisName++; } } peNode.setBytecodeName(shadowSig.getName() + "!" + String.valueOf(numberOfChildrenWithThisName + 1)); peNode.setBytecodeSignature(shadowSig.getSignature()); enclosingNode.addChild(peNode); return peNode; }
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
private static IProgramElement lookupMember(IHierarchy model, UnresolvedType declaringType, Member member) { IProgramElement typeElement = model.findElementForType(declaringType.getPackageName(), declaringType.getClassName()); if (typeElement == null) { return null; } for (Iterator it = typeElement.getChildren().iterator(); it.hasNext();) { IProgramElement element = (IProgramElement) it.next(); if (member.getName().equals(element.getBytecodeName()) && member.getSignature().equals(element.getBytecodeSignature())) { return element; } } return typeElement; } /** * Add a relationship for a matching declare annotation method or declare annotation constructor. Locating the method is a messy * (for messy read 'fragile') bit of code that could break at any moment but it's working for my simple testcase. */ public static void addDeclareAnnotationMethodRelationship(ISourceLocation sourceLocation, String affectedTypeName, ResolvedMember affectedMethod, AsmManager model) { if (model == null) { return; } String pkg = null; String type = affectedTypeName; int packageSeparator = affectedTypeName.lastIndexOf("."); if (packageSeparator != -1) { pkg = affectedTypeName.substring(0, packageSeparator); type = affectedTypeName.substring(packageSeparator + 1); }
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
IHierarchy hierarchy = model.getHierarchy(); IProgramElement typeElem = hierarchy.findElementForType(pkg, type); if (typeElem == null) return; StringBuffer parmString = new StringBuffer("("); UnresolvedType[] args = affectedMethod.getParameterTypes(); for (int i = 0; i < args.length; i++) { String s = args[i].getName(); parmString.append(s); if ((i + 1) < args.length) parmString.append(","); } parmString.append(")"); IProgramElement methodElem = null; if (affectedMethod.getName().startsWith("<init>")) { methodElem = hierarchy.findElementForSignature(typeElem, IProgramElement.Kind.CONSTRUCTOR, type + parmString); if (methodElem == null && args.length == 0) methodElem = typeElem; } else { methodElem = hierarchy.findElementForSignature(typeElem, IProgramElement.Kind.METHOD, affectedMethod.getName() + parmString); } if (methodElem == null) return; try { String targetHandle = methodElem.getHandleIdentifier();
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
if (targetHandle == null) return; IProgramElement sourceNode = hierarchy.findElementForSourceLine(sourceLocation); String sourceHandle = model.getHandleProvider().createHandleIdentifier(sourceNode); if (sourceHandle == null) return; IRelationshipMap mapper = model.getRelationshipMap(); IRelationship foreward = mapper.get(sourceHandle, IRelationship.Kind.DECLARE_INTER_TYPE, ANNOTATES, false, true); foreward.addTarget(targetHandle); IRelationship back = mapper.get(targetHandle, IRelationship.Kind.DECLARE_INTER_TYPE, ANNOTATED_BY, false, true); back.addTarget(sourceHandle); } catch (Throwable t) { t.printStackTrace(); } } /** * Add a relationship for a matching declare ATfield. Locating the field is trickier than it might seem since we have no line * number info for it, we have to dig through the structure model under the fields' type in order to locate it. */ public static void addDeclareAnnotationFieldRelationship(AsmManager model, ISourceLocation declareLocation, String affectedTypeName, ResolvedMember affectedFieldName) { if (model == null) { return; } String pkg = null; String type = affectedTypeName; int packageSeparator = affectedTypeName.lastIndexOf("."); if (packageSeparator != -1) {
269,902
Bug 269902 NPE in AsmRelationshipProvider.addRelationship
When doing a clean build of my project, seeing dozens, upwards of 100 of NPEs similar to the following: java.lang.NullPointerException at org.aspectj.weaver.model.AsmRelationshipProvider.addRelationship(AsmRelationshipProvider.java:168) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:124) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:441) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:103) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1732) at org.aspectj.weaver.b ... FWIW, this is seen for Spring-managed auto-injection of beans with the @Configurable annotation. Official AJDT version is: 1.6.4.20090304172355 Version: 3.4.2 Build id: M20090211-17
resolved fixed
d5e900d
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T02:25:32Z
2009-03-24T21:26:40Z
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
pkg = affectedTypeName.substring(0, packageSeparator); type = affectedTypeName.substring(packageSeparator + 1); } IHierarchy hierarchy = model.getHierarchy(); IProgramElement typeElem = hierarchy.findElementForType(pkg, type); if (typeElem == null) { return; } IProgramElement fieldElem = hierarchy.findElementForSignature(typeElem, IProgramElement.Kind.FIELD, affectedFieldName .getName()); if (fieldElem == null) { return; } String targetHandle = fieldElem.getHandleIdentifier(); if (targetHandle == null) { return; } IProgramElement sourceNode = hierarchy.findElementForSourceLine(declareLocation); String sourceHandle = model.getHandleProvider().createHandleIdentifier(sourceNode); if (sourceHandle == null) { return; } IRelationshipMap relmap = model.getRelationshipMap(); IRelationship foreward = relmap.get(sourceHandle, IRelationship.Kind.DECLARE_INTER_TYPE, ANNOTATES, false, true); foreward.addTarget(targetHandle); IRelationship back = relmap.get(targetHandle, IRelationship.Kind.DECLARE_INTER_TYPE, ANNOTATED_BY, false, true); back.addTarget(sourceHandle); } }
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.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.core.builder; import java.io.File; import java.io.FileFilter; import java.io.FilenameFilter; import java.io.IOException; import java.lang.ref.ReferenceQueue; import java.lang.ref.SoftReference; import java.util.AbstractMap; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Hashtable; import java.util.Iterator; import java.util.LinkedList; import java.util.List;
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
import java.util.Map; import java.util.Set; import org.aspectj.ajdt.internal.compiler.CompilationResultDestinationManager; import org.aspectj.ajdt.internal.compiler.InterimCompilationResult; import org.aspectj.asm.AsmManager; import org.aspectj.bridge.IMessage; import org.aspectj.bridge.Message; import org.aspectj.bridge.SourceLocation; import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation; import org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult; import org.aspectj.org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; import org.aspectj.org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException; import org.aspectj.org.eclipse.jdt.internal.compiler.env.IBinaryAnnotation; import org.aspectj.org.eclipse.jdt.internal.compiler.env.IBinaryField; import org.aspectj.org.eclipse.jdt.internal.compiler.env.IBinaryMethod; 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.lookup.ExtraCompilerModifiers; import org.aspectj.org.eclipse.jdt.internal.core.builder.ReferenceCollection; import org.aspectj.org.eclipse.jdt.internal.core.builder.StringSet; import org.aspectj.util.FileUtil; import org.aspectj.weaver.BCException; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.bcel.BcelWeaver; import org.aspectj.weaver.bcel.BcelWorld; import org.aspectj.weaver.bcel.UnwovenClassFile; /** * Maintains state needed for incremental compilation */ public class AjState implements CompilerConfigurationChangeFlags {
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
public static boolean CHECK_STATE_FIRST = true; public static IStateListener stateListener = null; public static boolean FORCE_INCREMENTAL_DURING_TESTING = false; private final AjBuildManager buildManager; private boolean couldBeSubsequentIncrementalBuild = false; private INameEnvironment nameEnvironment; private AsmManager structureModel; /** * When looking at changes on the classpath, this set accumulates files in our state instance that affected by those changes. * Then if we can do an incremental build - these must be compiled. */ private final Set affectedFiles = new HashSet(); private long lastSuccessfulFullBuildTime = -1; private final Hashtable structuralChangesSinceLastFullBuild = new Hashtable(); private long lastSuccessfulBuildTime = -1; private long currentBuildTime = -1; private AjBuildConfig buildConfig; private boolean batchBuildRequiredThisTime = false; /** * Keeps a list of (FQN,Filename) pairs (as ClassFile objects) for types that resulted from the compilation of the given File. * Note :- the ClassFile objects contain no byte code, they are simply a Filename,typename pair. * * Populated in noteResult and used in addDependentsOf(File)
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
* * Added by AMC during state refactoring, 1Q06. */ private final MapfullyQualifiedTypeNamesResultingFromCompilationUnit = new HashMap(); /** * Source files defining aspects * * Populated in noteResult and used in processDeletedFiles * * Added by AMC during state refactoring, 1Q06. */ private final SetsourceFilesDefiningAspects = new HashSet(); /** * Populated in noteResult to record the set of types that should be recompiled if the given file is modified or deleted. * * Refered to during addAffectedSourceFiles when calculating incremental compilation set. */ private final Mapreferences = new HashMap(); /** * Holds UnwovenClassFiles (byte[]s) originating from the given file source. This could be a jar file, a directory, or an * individual .class file. This is an *expensive* map. It is cleared immediately following a batch build, and the cheaper * inputClassFilesBySource map is kept for processing of any subsequent incremental builds. * * Populated during AjBuildManager.initBcelWorld(). * * Passed into AjCompiler adapter as the set of binary input files to reweave if the weaver determines a full weave is required. * * Cleared during initBcelWorld prior to repopulation. * * Used when a file is deleted during incremental compilation to delete all of the class files in the output directory that
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
* resulted from the weaving of File. * * Used during getBinaryFilesToCompile when compiling incrementally to determine which files should be recompiled if a given * input file has changed. * */ private MapbinarySourceFiles = new HashMap(); /** * Initially a duplicate of the information held in binarySourceFiles, with the key difference that the values are ClassFiles * (type name, File) not UnwovenClassFiles (which also have all the byte code in them). After a batch build, binarySourceFiles * is cleared, leaving just this much lighter weight map to use in processing subsequent incremental builds. */ private final MapinputClassFilesBySource = new HashMap(); /** * A list of the .class files created by this state that contain aspects. */ private final ListaspectClassFiles = new ArrayList(); /** * Holds structure information on types as they were at the end of the last build. It would be nice to get rid of this too, but * can't see an easy way to do that right now. */ private final MapresolvedTypeStructuresFromLastBuild = new HashMap(); /** * Populated in noteResult to record the set of UnwovenClassFiles (intermediate results) that originated from compilation of the * class with the given fully-qualified name. * * Used in removeAllResultsOfLastBuild to remove .class files from output directory. * * Passed into StatefulNameEnvironment during incremental compilation to support findType lookups. */
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
private final MapclassesFromName = new HashMap(); /** * Populated by AjBuildManager to record the aspects with the file name in which they're contained. This is later used when * writing the outxml file in AjBuildManager. Need to record the file name because want to write an outxml file for each of the * output directories and in order to ask the OutputLocationManager for the output location for a given aspect we need the file * in which it is contained. */ private Map aspectsFromFileNames; private SetcompiledSourceFiles = new HashSet(); private final Mapresources = new HashMap(); private StringSet qualifiedStrings = new StringSet(3); private StringSet simpleStrings = new StringSet(3); private Set addedFiles; private Set deletedFiles; private Set addedBinaryFiles; private Set deletedBinaryFiles; private BcelWeaver weaver; private BcelWorld world; public AjState(AjBuildManager buildManager) { this.buildManager = buildManager; } public void setCouldBeSubsequentIncrementalBuild(boolean yesThereCould) { this.couldBeSubsequentIncrementalBuild = yesThereCould; } void successfulCompile(AjBuildConfig config, boolean wasFullBuild) { buildConfig = config; lastSuccessfulBuildTime = currentBuildTime;
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
if (stateListener != null) stateListener.buildSuccessful(wasFullBuild); if (wasFullBuild) lastSuccessfulFullBuildTime = currentBuildTime; } /** * Returns false if a batch build is needed. */ public boolean prepareForNextBuild(AjBuildConfig newBuildConfig) { currentBuildTime = System.currentTimeMillis(); if (!maybeIncremental()) { if (listenerDefined()) getListener().recordDecision( "Preparing for build: not going to be incremental because either not in AJDT or incremental deactivated"); return false; } if (this.batchBuildRequiredThisTime) { this.batchBuildRequiredThisTime = false; if (listenerDefined()) getListener().recordDecision( "Preparing for build: not going to be incremental this time because batch build explicitly forced"); return false; } if (lastSuccessfulBuildTime == -1 || buildConfig == null) { structuralChangesSinceLastFullBuild.clear(); if (listenerDefined()) getListener().recordDecision( "Preparing for build: not going to be incremental because no successful previous full build"); return false; }
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
if (newBuildConfig.getOutputJar() != null) { structuralChangesSinceLastFullBuild.clear(); if (listenerDefined()) getListener().recordDecision("Preparing for build: not going to be incremental because outjar being used"); return false; } affectedFiles.clear(); if (pathChange(buildConfig, newBuildConfig)) { removeAllResultsOfLastBuild(); if (stateListener != null) { stateListener.pathChangeDetected(); } structuralChangesSinceLastFullBuild.clear(); if (listenerDefined()) getListener() .recordDecision( "Preparing for build: not going to be incremental because path change detected (one of classpath/aspectpath/inpath/injars)"); return false; } if (simpleStrings.elementSize > 20) { simpleStrings = new StringSet(3); } else {
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
simpleStrings.clear(); } if (qualifiedStrings.elementSize > 20) { qualifiedStrings = new StringSet(3); } else { qualifiedStrings.clear(); } if ((newBuildConfig.getChanged() & PROJECTSOURCEFILES_CHANGED) == 0) { addedFiles = Collections.EMPTY_SET; deletedFiles = Collections.EMPTY_SET; } else { Set oldFiles = new HashSet(buildConfig.getFiles()); Set newFiles = new HashSet(newBuildConfig.getFiles()); addedFiles = new HashSet(newFiles); addedFiles.removeAll(oldFiles); deletedFiles = new HashSet(oldFiles); deletedFiles.removeAll(newFiles); } Set oldBinaryFiles = new HashSet(buildConfig.getBinaryFiles()); Set newBinaryFiles = new HashSet(newBuildConfig.getBinaryFiles()); addedBinaryFiles = new HashSet(newBinaryFiles); addedBinaryFiles.removeAll(oldBinaryFiles); deletedBinaryFiles = new HashSet(oldBinaryFiles); deletedBinaryFiles.removeAll(newBinaryFiles); boolean couldStillBeIncremental = processDeletedFiles(deletedFiles); if (!couldStillBeIncremental) { if (listenerDefined()) getListener().recordDecision("Preparing for build: not going to be incremental because an aspect was deleted"); return false; }
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
if (listenerDefined()) getListener().recordDecision("Preparing for build: planning to be an incremental build"); return true; } /** * Checks if any of the files in the set passed in contains an aspect declaration. If one is found then we start the process of * batch building, i.e. we remove all the results of the last build, call any registered listener to tell them whats happened * and return false. * * @return false if we discovered an aspect declaration */ private boolean processDeletedFiles(Set deletedFiles) { for (Iterator iter = deletedFiles.iterator(); iter.hasNext();) { File aDeletedFile = (File) iter.next(); if (this.sourceFilesDefiningAspects.contains(aDeletedFile)) { removeAllResultsOfLastBuild(); if (stateListener != null) { stateListener.detectedAspectDeleted(aDeletedFile); } return false; } Listclasses = (List) fullyQualifiedTypeNamesResultingFromCompilationUnit.get(aDeletedFile); if (classes != null) { for (Iterator iterator = classes.iterator(); iterator.hasNext();) { ClassFile element = (ClassFile) iterator.next(); resolvedTypeStructuresFromLastBuild.remove(element.fullyQualifiedTypeName); } } } return true;
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
} private Collection getModifiedFiles() { return getModifiedFiles(lastSuccessfulBuildTime); } Collection getModifiedFiles(long lastBuildTime) { Set ret = new HashSet(); ListmodifiedFiles = buildConfig.getModifiedFiles(); if (modifiedFiles == null) { for (Iterator i = buildConfig.getFiles().iterator(); i.hasNext();) { File file = (File) i.next(); if (!file.exists()) continue; long modTime = file.lastModified(); if (modTime + 1000 > lastBuildTime) { ret.add(file); } } } else { ret.addAll(modifiedFiles); } ret.addAll(affectedFiles); return ret; } private Collection getModifiedBinaryFiles() { return getModifiedBinaryFiles(lastSuccessfulBuildTime);
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
} Collection getModifiedBinaryFiles(long lastBuildTime) { List ret = new ArrayList(); for (Iterator i = buildConfig.getBinaryFiles().iterator(); i.hasNext();) { AjBuildConfig.BinarySourceFile bsfile = (AjBuildConfig.BinarySourceFile) i.next(); File file = bsfile.binSrc; if (!file.exists()) continue; long modTime = file.lastModified(); if (modTime + 1000 >= lastBuildTime) { ret.add(bsfile); } } return ret; } private static int CLASS_FILE_NO_CHANGES = 0; private static int CLASS_FILE_CHANGED_THAT_NEEDS_INCREMENTAL_BUILD = 1; private static int CLASS_FILE_CHANGED_THAT_NEEDS_FULL_BUILD = 2; private static int MAX_AFFECTED_FILES_BEFORE_FULL_BUILD = 30; public static final FileFilter classFileFilter = new FileFilter() { public boolean accept(File pathname) { return pathname.getName().endsWith(".class"); } }; /** * Analyse .class files in the directory specified, if they have changed since the last successful build then see if we can * determine which source files in our project depend on the change. If we can then we can still do an incremental build, if we
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
* can't then we have to do a full build. * */ private int classFileChangedInDirSinceLastBuildRequiringFullBuild(File dir) { if (!dir.isDirectory()) { return CLASS_FILE_CHANGED_THAT_NEEDS_FULL_BUILD; } AjState state = IncrementalStateManager.findStateManagingOutputLocation(dir); if (listenerDefined()) { if (state != null) { getListener().recordDecision("Found state instance managing output location : " + dir); } else { getListener().recordDecision("Failed to find a state instance managing output location : " + dir); } } if (state != null && !state.hasAnyStructuralChangesSince(lastSuccessfulBuildTime)) { if (listenerDefined()) { getListener().recordDecision("No reported changes in that state"); } return CLASS_FILE_NO_CHANGES; } if (state == null) {
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
CompilationResultDestinationManager crdm = buildConfig.getCompilationResultDestinationManager(); if (crdm!=null) { int i = crdm.discoverChangesSince(dir,lastSuccessfulBuildTime); if (i==1) { if (listenerDefined()) { getListener().recordDecision("'"+dir+"' is apparently unchanged so not performing timestamp check"); } return CLASS_FILE_NO_CHANGES; } } } List classFiles = FileUtil.listClassFiles(dir); for (Iterator iterator = classFiles.iterator(); iterator.hasNext();) { File classFile = (File) iterator.next(); if (CHECK_STATE_FIRST && state != null) { if (state.isAspect(classFile)) { return CLASS_FILE_CHANGED_THAT_NEEDS_FULL_BUILD; } if (state.hasStructuralChangedSince(classFile, lastSuccessfulBuildTime)) { if (listenerDefined()) { getListener().recordDecision("Structural change detected in : " + classFile); } if (isTypeWeReferTo(classFile)) { if (affectedFiles.size() > MAX_AFFECTED_FILES_BEFORE_FULL_BUILD) return CLASS_FILE_CHANGED_THAT_NEEDS_FULL_BUILD; }
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
} } else { long modTime = classFile.lastModified(); if ((modTime + 1000) >= lastSuccessfulBuildTime) { if (state != null) { if (state.isAspect(classFile)) { return CLASS_FILE_CHANGED_THAT_NEEDS_FULL_BUILD; } if (state.hasStructuralChangedSince(classFile, lastSuccessfulBuildTime)) { if (listenerDefined()) { getListener().recordDecision("Structural change detected in : " + classFile); } if (isTypeWeReferTo(classFile)) { if (affectedFiles.size() > MAX_AFFECTED_FILES_BEFORE_FULL_BUILD) return CLASS_FILE_CHANGED_THAT_NEEDS_FULL_BUILD; } } else { if (listenerDefined()) getListener().recordDecision("Change detected in " + classFile + " but it is not structural"); } } else {
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
if (isTypeWeReferTo(classFile)) { if (affectedFiles.size() > MAX_AFFECTED_FILES_BEFORE_FULL_BUILD) return CLASS_FILE_CHANGED_THAT_NEEDS_FULL_BUILD; return CLASS_FILE_CHANGED_THAT_NEEDS_INCREMENTAL_BUILD; } else { return CLASS_FILE_NO_CHANGES; } } } } } return CLASS_FILE_NO_CHANGES; } private boolean isAspect(File file) { return aspectClassFiles.contains(file.getAbsolutePath()); } public static class SoftHashMap extends AbstractMap { private final Map map; private final ReferenceQueue rq = new ReferenceQueue(); public SoftHashMap(Map map) { this.map = map; } public SoftHashMap() { this(new HashMap()); } public SoftHashMap(Map map, boolean b) { this(map); } class SoftReferenceKnownKey extends SoftReference {
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
private final Object key; SoftReferenceKnownKey(Object k, Object v) { super(v, rq); this.key = k; } } private void processQueue() { SoftReferenceKnownKey sv = null; while ((sv = (SoftReferenceKnownKey) rq.poll()) != null) { map.remove(sv.key); } } public Object get(Object key) { SoftReferenceKnownKey value = (SoftReferenceKnownKey) map.get(key); if (value == null) return null; if (value.get() == null) { map.remove(value.key); return null; } else { return value.get(); } }
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
public Object put(Object k, Object v) { processQueue(); return map.put(k, new SoftReferenceKnownKey(k, v)); } public Set entrySet() { return map.entrySet(); } public void clear() { processQueue(); map.clear(); } public int size() { processQueue(); return map.size(); } public Object remove(Object k) { processQueue(); SoftReferenceKnownKey value = (SoftReferenceKnownKey) map.remove(k); if (value == null) return null; if (value.get() != null) { return value.get(); } return null; } } SoftHashMapfileToClassNameMap = new SoftHashMap(); /** * If a class file has changed in a path on our classpath, it may not be for a type that any of our source files care about. * This method checks if any of our source files have a dependency on the class in question and if not, we don't consider it an
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
* interesting change. */ private boolean isTypeWeReferTo(File file) { String fpath = file.getAbsolutePath(); int finalSeparator = fpath.lastIndexOf(File.separator); String baseDir = fpath.substring(0, finalSeparator); String theFile = fpath.substring(finalSeparator + 1); SoftHashMap classNames = (SoftHashMap) fileToClassNameMap.get(baseDir); if (classNames == null) { classNames = new SoftHashMap(); fileToClassNameMap.put(baseDir, classNames); } char[] className = (char[]) classNames.get(theFile); if (className == null) { ClassFileReader cfr; try { cfr = ClassFileReader.read(file); } catch (ClassFormatException e) { return true; } catch (IOException e) { return true; } className = cfr.getName(); classNames.put(theFile, className); }
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
char[][][] qualifiedNames = null; char[][] simpleNames = null; if (CharOperation.indexOf('/', className) != -1) { qualifiedNames = new char[1][][]; qualifiedNames[0] = CharOperation.splitOn('/', className); qualifiedNames = ReferenceCollection.internQualifiedNames(qualifiedNames); } else { simpleNames = new char[1][]; simpleNames[0] = className; simpleNames = ReferenceCollection.internSimpleNames(simpleNames, true); } for (Iterator i = references.entrySet().iterator(); i.hasNext();) { Map.Entry entry = (Map.Entry) i.next(); ReferenceCollection refs = (ReferenceCollection) entry.getValue(); if (refs != null && refs.includes(qualifiedNames, simpleNames)) { if (listenerDefined()) { getListener().recordDecision( toString() + ": type " + new String(className) + " is depended upon by '" + entry.getKey() + "'"); } affectedFiles.add(entry.getKey()); if (affectedFiles.size() > MAX_AFFECTED_FILES_BEFORE_FULL_BUILD) return true; } } if (affectedFiles.size() > 0) return true; if (listenerDefined()) getListener().recordDecision(toString() + ": type " + new String(className) + " is not depended upon by this state"); return false;
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
} public String toString() { StringBuffer sb = new StringBuffer(); sb.append("AjState(").append((buildConfig == null ? "NULLCONFIG" : buildConfig.getConfigFile().toString())).append(")"); return sb.toString(); } /** * Determine if a file has changed since a given time, using the local information recorded in the structural changes data * structure. * * @param file the file we are wondering about * @param lastSuccessfulBuildTime the last build time for the state asking the question
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
*/ private boolean hasStructuralChangedSince(File file, long lastSuccessfulBuildTime) { Long l = (Long) structuralChangesSinceLastFullBuild.get(file.getAbsolutePath()); long strucModTime = -1; if (l != null) strucModTime = l.longValue(); else strucModTime = this.lastSuccessfulFullBuildTime; return (strucModTime > lastSuccessfulBuildTime); } /** * Determine if anything has changed since a given time. */ private boolean hasAnyStructuralChangesSince(long lastSuccessfulBuildTime) { Set entries = structuralChangesSinceLastFullBuild.entrySet(); for (Iterator iterator = entries.iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); Long l = (Long) entry.getValue(); if (l != null) { long lvalue = l.longValue(); if (lvalue > lastSuccessfulBuildTime) { if (listenerDefined()) { getListener().recordDecision( "Seems this has changed " + entry.getKey() + "modtime=" + lvalue + " lsbt=" + this.lastSuccessfulFullBuildTime + " incoming check value=" + lastSuccessfulBuildTime); } return true;
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
} } } return (this.lastSuccessfulFullBuildTime > lastSuccessfulBuildTime); } /** * Determine if something has changed on the classpath/inpath/aspectpath and a full build is required rather than an incremental * one. * * @param previousConfig the previous configuration used * @param newConfig the new configuration being used * @return true if full build required */ private boolean pathChange(AjBuildConfig previousConfig, AjBuildConfig newConfig) { int changes = newConfig.getChanged(); if ((changes & (CLASSPATH_CHANGED | ASPECTPATH_CHANGED | INPATH_CHANGED | OUTPUTDESTINATIONS_CHANGED | INJARS_CHANGED)) != 0) { List oldOutputLocs = getOutputLocations(previousConfig); Set alreadyAnalysedPaths = new HashSet(); List oldClasspath = previousConfig.getClasspath(); List newClasspath = newConfig.getClasspath(); if (stateListener != null) stateListener.aboutToCompareClasspaths(oldClasspath, newClasspath); if (classpathChangedAndNeedsFullBuild(oldClasspath, newClasspath, true, oldOutputLocs, alreadyAnalysedPaths)) return true; List oldAspectpath = previousConfig.getAspectpath(); List newAspectpath = newConfig.getAspectpath(); if (changedAndNeedsFullBuild(oldAspectpath, newAspectpath, true, oldOutputLocs, alreadyAnalysedPaths)) return true; List oldInPath = previousConfig.getInpath(); List newInPath = newConfig.getInpath();
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
if (changedAndNeedsFullBuild(oldInPath, newInPath, false, oldOutputLocs, alreadyAnalysedPaths)) return true; List oldInJars = previousConfig.getInJars(); List newInJars = newConfig.getInJars(); if (changedAndNeedsFullBuild(oldInJars, newInJars, false, oldOutputLocs, alreadyAnalysedPaths)) return true; } else if (newConfig.getClasspathElementsWithModifiedContents() != null) { ListmodifiedCpElements = newConfig.getClasspathElementsWithModifiedContents(); for (Iterator iterator = modifiedCpElements.iterator(); iterator.hasNext();) { File cpElement = new File((String) iterator.next()); if (cpElement.exists() && !cpElement.isDirectory()) { if (cpElement.lastModified() > lastSuccessfulBuildTime) { return true; } } else { int classFileChanges = classFileChangedInDirSinceLastBuildRequiringFullBuild(cpElement); if (classFileChanges == CLASS_FILE_CHANGED_THAT_NEEDS_FULL_BUILD) { return true; } } } } return false; } /**
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
* Return a list of the output locations - this includes any 'default' output location and then any known by a registered * CompilationResultDestinationManager. * * @param config the build configuration for which the output locations should be determined * @return a list of file objects */ private List getOutputLocations(AjBuildConfig config) { List outputLocs = new ArrayList(); if (config.getOutputDir() != null) { try { outputLocs.add(config.getOutputDir().getCanonicalFile()); } catch (IOException e) { } } if (config.getCompilationResultDestinationManager() != null) { List dirs = config.getCompilationResultDestinationManager().getAllOutputLocations(); for (Iterator iterator = dirs.iterator(); iterator.hasNext();) { File f = (File) iterator.next(); try { File cf = f.getCanonicalFile(); if (!outputLocs.contains(cf)) { outputLocs.add(cf); } } catch (IOException e) { } } } return outputLocs; }
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
private File getOutputLocationFor(AjBuildConfig config, File aResourceFile) { List outputLocs = new ArrayList(); if (config.getCompilationResultDestinationManager() != null) { File outputLoc = config.getCompilationResultDestinationManager().getOutputLocationForResource(aResourceFile); if (outputLoc != null) return outputLoc; } if (config.getOutputDir() != null) { return config.getOutputDir(); } return null; } /** * Check the old and new paths, if they vary by length or individual elements then that is considered a change. Or if the last * modified time of a path entry has changed (or last modified time of a classfile in that path entry has changed) then return * true. The outputlocations are supplied so they can be 'ignored' in the comparison. * * @param oldPath * @param newPath * @param checkClassFiles whether to examine individual class files within directories * @param outputLocs the output locations that should be ignored if they occur on the paths being compared * @return true if a change is detected that requires a full build */ private boolean changedAndNeedsFullBuild(List oldPath, List newPath, boolean checkClassFiles, List outputLocs, Set alreadyAnalysedPaths) {
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
if (oldPath.size() != newPath.size()) { return true; } for (int i = 0; i < oldPath.size(); i++) { if (!oldPath.get(i).equals(newPath.get(i))) { return true; } Object o = oldPath.get(i); File f = null; if (o instanceof String) { f = new File((String) o); } else { f = (File) o; } if (f.exists() && !f.isDirectory() && (f.lastModified() >= lastSuccessfulBuildTime)) { return true; } if (checkClassFiles && f.exists() && f.isDirectory()) { boolean foundMatch = false; for (Iterator iterator = outputLocs.iterator(); !foundMatch && iterator.hasNext();) { File dir = (File) iterator.next(); if (f.equals(dir)) { foundMatch = true; }
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
} if (!foundMatch) { if (!alreadyAnalysedPaths.contains(f.getAbsolutePath())) { alreadyAnalysedPaths.add(f.getAbsolutePath()); int classFileChanges = classFileChangedInDirSinceLastBuildRequiringFullBuild(f); if (classFileChanges == CLASS_FILE_CHANGED_THAT_NEEDS_FULL_BUILD) return true; } } } } return false; } /** * Check the old and new paths, if they vary by length or individual elements then that is considered a change. Or if the last * modified time of a path entry has changed (or last modified time of a classfile in that path entry has changed) then return * true. The outputlocations are supplied so they can be 'ignored' in the comparison. * * @param oldPath * @param newPath * @param checkClassFiles whether to examine individual class files within directories * @param outputLocs the output locations that should be ignored if they occur on the paths being compared * @return true if a change is detected that requires a full build */ private boolean classpathChangedAndNeedsFullBuild(List oldPath, List newPath, boolean checkClassFiles, List outputLocs, Set alreadyAnalysedPaths) {
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
if (oldPath.size() != newPath.size()) { return true; } for (int i = 0; i < oldPath.size(); i++) { if (!oldPath.get(i).equals(newPath.get(i))) { return true; } File f = new File((String) oldPath.get(i)); if (f.exists() && !f.isDirectory() && (f.lastModified() >= lastSuccessfulBuildTime)) { return true; } if (checkClassFiles && f.exists() && f.isDirectory()) { boolean foundMatch = false; for (Iterator iterator = outputLocs.iterator(); !foundMatch && iterator.hasNext();) { File dir = (File) iterator.next(); if (f.equals(dir)) { foundMatch = true; } } if (!foundMatch) { if (!alreadyAnalysedPaths.contains(f.getAbsolutePath())) { alreadyAnalysedPaths.add(f.getAbsolutePath()); int classFileChanges = classFileChangedInDirSinceLastBuildRequiringFullBuild(f); if (classFileChanges == CLASS_FILE_CHANGED_THAT_NEEDS_FULL_BUILD)
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
return true; } } } } return false; } public Set getFilesToCompile(boolean firstPass) { Set thisTime = new HashSet(); if (firstPass) { compiledSourceFiles = new HashSet(); Collection modifiedFiles = getModifiedFiles(); thisTime.addAll(modifiedFiles); if (addedFiles != null) { for (Iterator fIter = addedFiles.iterator(); fIter.hasNext();) { Object o = fIter.next(); if (!thisTime.contains(o)) thisTime.add(o); } } deleteClassFiles();
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
addAffectedSourceFiles(thisTime, thisTime); } else { addAffectedSourceFiles(thisTime, compiledSourceFiles); } compiledSourceFiles = thisTime; return thisTime; } private boolean maybeIncremental() { return (FORCE_INCREMENTAL_DURING_TESTING || this.couldBeSubsequentIncrementalBuild); } public Map getBinaryFilesToCompile(boolean firstTime) { if (lastSuccessfulBuildTime == -1 || buildConfig == null || !maybeIncremental()) { return binarySourceFiles; } Map toWeave = new HashMap(); if (firstTime) { List addedOrModified = new ArrayList(); addedOrModified.addAll(addedBinaryFiles); addedOrModified.addAll(getModifiedBinaryFiles()); for (Iterator iter = addedOrModified.iterator(); iter.hasNext();) { AjBuildConfig.BinarySourceFile bsf = (AjBuildConfig.BinarySourceFile) iter.next(); UnwovenClassFile ucf = createUnwovenClassFile(bsf); if (ucf == null) continue; List ucfs = new ArrayList(); ucfs.add(ucf);
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
recordTypeChanged(ucf.getClassName()); binarySourceFiles.put(bsf.binSrc.getPath(), ucfs); List cfs = new ArrayList(1); cfs.add(getClassFileFor(ucf)); this.inputClassFilesBySource.put(bsf.binSrc.getPath(), cfs); toWeave.put(bsf.binSrc.getPath(), ucfs); } deleteBinaryClassFiles(); } else { } return toWeave; } /** * Called when a path change is about to trigger a full build, but we haven't cleaned up from the last incremental build... */ private void removeAllResultsOfLastBuild() { for (Iterator iter = this.inputClassFilesBySource.values().iterator(); iter.hasNext();) { List cfs = (List) iter.next(); for (Iterator iterator = cfs.iterator(); iterator.hasNext();) { ClassFile cf = (ClassFile) iterator.next(); cf.deleteFromFileSystem(buildConfig); } } for (Iterator iterator = classesFromName.values().iterator(); iterator.hasNext();) { File f = (File) iterator.next(); new ClassFile("", f).deleteFromFileSystem(buildConfig); } Set resourceEntries = resources.entrySet();
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
for (Iterator iter = resourceEntries.iterator(); iter.hasNext();) { Map.Entry resourcePair = (Map.Entry) iter.next(); File sourcePath = (File) resourcePair.getValue(); File outputLoc = getOutputLocationFor(buildConfig, sourcePath); if (outputLoc != null) { outputLoc = new File(outputLoc, (String) resourcePair.getKey()); if (!outputLoc.getPath().equals(sourcePath.getPath()) && outputLoc.exists()) { outputLoc.delete(); if (buildConfig.getCompilationResultDestinationManager() != null) { buildConfig.getCompilationResultDestinationManager().reportFileRemove(outputLoc.getPath(), CompilationResultDestinationManager.FILETYPE_RESOURCE); } } } } } private void deleteClassFiles() { if (deletedFiles == null) { return; } for (Iterator i = deletedFiles.iterator(); i.hasNext();) { File deletedFile = (File) i.next(); addDependentsOf(deletedFile); List cfs = (List) this.fullyQualifiedTypeNamesResultingFromCompilationUnit.get(deletedFile); this.fullyQualifiedTypeNamesResultingFromCompilationUnit.remove(deletedFile); if (cfs != null) { for (Iterator iter = cfs.iterator(); iter.hasNext();) { ClassFile cf = (ClassFile) iter.next(); deleteClassFile(cf); }
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
} } } private void deleteBinaryClassFiles() { for (Iterator iter = deletedBinaryFiles.iterator(); iter.hasNext();) { AjBuildConfig.BinarySourceFile deletedFile = (AjBuildConfig.BinarySourceFile) iter.next(); List cfs = (List) this.inputClassFilesBySource.get(deletedFile.binSrc.getPath()); for (Iterator iterator = cfs.iterator(); iterator.hasNext();) { deleteClassFile((ClassFile) iterator.next()); } this.inputClassFilesBySource.remove(deletedFile.binSrc.getPath()); } }
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
private void deleteClassFile(ClassFile cf) { classesFromName.remove(cf.fullyQualifiedTypeName); weaver.deleteClassFile(cf.fullyQualifiedTypeName);
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
cf.deleteFromFileSystem(buildConfig); } private UnwovenClassFile createUnwovenClassFile(AjBuildConfig.BinarySourceFile bsf) { UnwovenClassFile ucf = null; try { File outputDir = buildConfig.getOutputDir(); if (buildConfig.getCompilationResultDestinationManager() != null) { outputDir = buildConfig.getCompilationResultDestinationManager().getDefaultOutputLocation(); } ucf = weaver.addClassFile(bsf.binSrc, bsf.fromInPathDirectory, outputDir); } catch (IOException ex) { IMessage msg = new Message("can't read class file " + bsf.binSrc.getPath(), new SourceLocation(bsf.binSrc, 0), false); buildManager.handler.handleMessage(msg); } return ucf; } public void noteResult(InterimCompilationResult result) { if (!maybeIncremental()) { return; } File sourceFile = new File(result.fileName()); CompilationResult cr = result.result(); references.put(sourceFile, new ReferenceCollection(cr.qualifiedReferences, cr.simpleNameReferences)); UnwovenClassFile[] unwovenClassFiles = result.unwovenClassFiles(); for (int i = 0; i < unwovenClassFiles.length; i++) { File lastTimeRound = (File) classesFromName.get(unwovenClassFiles[i].getClassName()); recordClassFile(unwovenClassFiles[i], lastTimeRound);
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
classesFromName.put(unwovenClassFiles[i].getClassName(), new File(unwovenClassFiles[i].getFilename())); } recordWhetherCompilationUnitDefinedAspect(sourceFile, cr); deleteTypesThatWereInThisCompilationUnitLastTimeRoundButHaveBeenDeletedInThisIncrement(sourceFile, unwovenClassFiles); recordFQNsResultingFromCompilationUnit(sourceFile, result); } public void noteNewResult(CompilationResult cr) {
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
} /** * @param sourceFile * @param unwovenClassFiles */ private void deleteTypesThatWereInThisCompilationUnitLastTimeRoundButHaveBeenDeletedInThisIncrement(File sourceFile, UnwovenClassFile[] unwovenClassFiles) { List classFiles = (List) this.fullyQualifiedTypeNamesResultingFromCompilationUnit.get(sourceFile); if (classFiles != null) { for (int i = 0; i < unwovenClassFiles.length; i++) { removeFromClassFilesIfPresent(unwovenClassFiles[i].getClassName(), classFiles); } for (Iterator iter = classFiles.iterator(); iter.hasNext();) { ClassFile cf = (ClassFile) iter.next(); deleteClassFile(cf); } } } private void removeFromClassFilesIfPresent(String className, List classFiles) { ClassFile victim = null; for (Iterator iter = classFiles.iterator(); iter.hasNext();) { ClassFile cf = (ClassFile) iter.next(); if (cf.fullyQualifiedTypeName.equals(className)) { victim = cf; break; }
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
} if (victim != null) { classFiles.remove(victim); } } /** * Record the fully-qualified names of the types that were declared in the given source file. * * @param sourceFile, the compilation unit * @param icr, the CompilationResult from compiling it */ private void recordFQNsResultingFromCompilationUnit(File sourceFile, InterimCompilationResult icr) { List classFiles = new ArrayList(); UnwovenClassFile[] types = icr.unwovenClassFiles(); for (int i = 0; i < types.length; i++) { classFiles.add(new ClassFile(types[i].getClassName(), new File(types[i].getFilename()))); } this.fullyQualifiedTypeNamesResultingFromCompilationUnit.put(sourceFile, classFiles); } /** * If this compilation unit defined an aspect, we need to know in case it is modified in a future increment. * * @param sourceFile * @param cr */ private void recordWhetherCompilationUnitDefinedAspect(File sourceFile, CompilationResult cr) { this.sourceFilesDefiningAspects.remove(sourceFile); if (cr != null) { Map compiledTypes = cr.compiledTypes; if (compiledTypes != null) {
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
for (Iterator iterator = compiledTypes.keySet().iterator(); iterator.hasNext();) { char[] className = (char[]) iterator.next(); String typeName = new String(className).replace('/', '.'); if (typeName.indexOf(BcelWeaver.SYNTHETIC_CLASS_POSTFIX) == -1) { ResolvedType rt = world.resolve(typeName); if (rt.isMissing()) { } else if (rt.isAspect()) { this.sourceFilesDefiningAspects.add(sourceFile); break; } } } } } }
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
private void recordClassFile(UnwovenClassFile thisTime, File lastTime) { if (simpleStrings == null) { ResolvedType rType = world.resolve(thisTime.getClassName()); if (!rType.isMissing()) { try { ClassFileReader reader = new ClassFileReader(thisTime.getBytes(), null); this.resolvedTypeStructuresFromLastBuild.put(thisTime.getClassName(), new CompactTypeStructureRepresentation( reader)); } catch (ClassFormatException cfe) { throw new BCException("Unexpected problem processing class", cfe); } } return; } CompactTypeStructureRepresentation existingStructure = (CompactTypeStructureRepresentation) this.resolvedTypeStructuresFromLastBuild .get(thisTime.getClassName()); ResolvedType newResolvedType = world.resolve(thisTime.getClassName()); if (!newResolvedType.isMissing()) { try { ClassFileReader reader = new ClassFileReader(thisTime.getBytes(), null); this.resolvedTypeStructuresFromLastBuild.put(thisTime.getClassName(), new CompactTypeStructureRepresentation(reader)); } catch (ClassFormatException cfe) { throw new BCException("Unexpected problem processing class", cfe); }
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
} if (lastTime == null) { recordTypeChanged(thisTime.getClassName()); return; } if (newResolvedType.isMissing()) { return; } world.ensureAdvancedConfigurationProcessed(); byte[] newBytes = thisTime.getBytes(); try { ClassFileReader reader = new ClassFileReader(newBytes, lastTime.getAbsolutePath().toCharArray()); if (!(reader.isLocal() || reader.isAnonymous())) { if (hasStructuralChanges(reader, existingStructure)) { if (world.forDEBUG_structuralChangesCode) System.err.println("Detected a structural change in " + thisTime.getFilename()); structuralChangesSinceLastFullBuild.put(thisTime.getFilename(), new Long(currentBuildTime)); recordTypeChanged(new String(reader.getName()).replace('/', '.')); } } } catch (ClassFormatException e) { recordTypeChanged(thisTime.getClassName()); } } private static final char[][] EMPTY_CHAR_ARRAY = new char[0][]; /** * Compare the class structure of the new intermediate (unwoven) class with the existingResolvedType of the same class that we * have in the world, looking for any structural differences (and ignoring aj members resulting from weaving....) *
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
* Some notes from Andy... lot of problems here, which I've eventually resolved by building the compactstructure based on a * classfilereader, rather than on a ResolvedType. There are accessors for inner types and funky fields that the compiler * creates to support the language - for non-static inner types it also mangles ctors to be prefixed with an instance of the * surrounding type. * * Warning : long but boring method implementation... * * @param reader * @param existingType * @return */ private boolean hasStructuralChanges(ClassFileReader reader, CompactTypeStructureRepresentation existingType) { if (existingType == null) { return true; } if (!modifiersEqual(reader.getModifiers(), existingType.modifiers)) { return true; } if (!CharOperation.equals(reader.getGenericSignature(), existingType.genericSignature)) { return true; } if (!CharOperation.equals(reader.getSuperclassName(), existingType.superclassName)) { return true; } IBinaryAnnotation[] newAnnos = reader.getAnnotations(); if (newAnnos == null || newAnnos.length == 0) {
270,033
Bug 270033 [incremental] Incremental compilation with aspects on an incoming classpath/aspectpath
null
resolved fixed
b23cc1a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2009-03-26T03:15:47Z
2009-03-25T22:26:40Z
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
if (existingType.annotations != null && existingType.annotations.length != 0) { return true; } } else { IBinaryAnnotation[] existingAnnos = existingType.annotations; if (existingAnnos == null || existingAnnos.length != newAnnos.length) { return true; } for (int i = 0; i < newAnnos.length; i++) { if (!CharOperation.equals(newAnnos[i].getTypeName(), existingAnnos[i].getTypeName())) { return true; } } } char[][] existingIfs = existingType.interfaces; char[][] newIfsAsChars = reader.getInterfaceNames(); if (newIfsAsChars == null) { newIfsAsChars = EMPTY_CHAR_ARRAY; } if (existingIfs == null) { existingIfs = EMPTY_CHAR_ARRAY; } if (existingIfs.length != newIfsAsChars.length) return true; new_interface_loop: for (int i = 0; i < newIfsAsChars.length; i++) { for (int j = 0; j < existingIfs.length; j++) { if (CharOperation.equals(existingIfs[j], newIfsAsChars[i])) {