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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
244,321 |
Bug 244321 I cannot aspect code written in SJPP-based encoding
| null |
resolved fixed
|
d5c2ead
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-08-29T20:08:59Z | 2008-08-15T17:06:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
|
}
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.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);
state.setWeaver(bcelWeaver);
state.clearBinarySourceFiles();
if (buildConfig.getLintMode().equals(AjBuildConfig.AJLINT_DEFAULT)) {
bcelWorld.getLint().loadDefaultProperties();
|
244,321 |
Bug 244321 I cannot aspect code written in SJPP-based encoding
| null |
resolved fixed
|
d5c2ead
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-08-29T20:08:59Z | 2008-08-15T17:06:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
|
} 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);
state.recordBinarySource(inJar.getPath(), unwovenClasses);
}
|
244,321 |
Bug 244321 I cannot aspect code written in SJPP-based encoding
| null |
resolved fixed
|
d5c2ead
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-08-29T20:08:59Z | 2008-08-15T17:06:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
|
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);
|
244,321 |
Bug 244321 I cannot aspect code written in SJPP-based encoding
| null |
resolved fixed
|
d5c2ead
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-08-29T20:08:59Z | 2008-08-15T17:06:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
|
handler.handleMessage(message);
}
}
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());
|
244,321 |
Bug 244321 I cannot aspect code written in SJPP-based encoding
| null |
resolved fixed
|
d5c2ead
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-08-29T20:08:59Z | 2008-08-15T17:06:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
|
}
/*
* Build the set of compilation source units
*/
public CompilationUnit[] getCompilationUnits(String[] filenames, String[] encodings) {
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++) {
String encoding = encodings[i];
if (encoding == null)
encoding = defaultEncoding;
units[i] = new CompilationUnit(null, filenames[i], encoding);
}
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));
}
|
244,321 |
Bug 244321 I cannot aspect code written in SJPP-based encoding
| null |
resolved fixed
|
d5c2ead
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-08-29T20:08:59Z | 2008-08-15T17:06:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
|
return System.getProperty("user.dir");
}
public void performCompilation(Collection files) {
if (progressListener != null) {
compiledCount=0;
sourceFileCount = files.size();
progressListener.setText("compiling source files");
}
String[] filenames = new String[files.size()];
String[] encodings = new String[files.size()];
int ii = 0;
for (Iterator fIterator = files.iterator(); fIterator.hasNext();) {
File f = (File) fIterator.next();
filenames[ii++] = f.getPath();
}
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 = getLibraryAccess(classpaths, filenames);
|
244,321 |
Bug 244321 I cannot aspect code written in SJPP-based encoding
| null |
resolved fixed
|
d5c2ead
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-08-29T20:08:59Z | 2008-08-15T17:06:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
|
environment = new StatefulNameEnvironment(environment, state.getClassNameToFileMap(),state);
}
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());
CompilerOptions options = compiler.options;
options.produceReferenceInfo = true;
try {
compiler.compile(getCompilationUnits(filenames, encodings));
} 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();
environment = null;
}
/*
* Answer the component to which will be handed back compilation results from the compiler
*/
public IIntermediateResultsRequestor getInterimResultRequestor() {
|
244,321 |
Bug 244321 I cannot aspect code written in SJPP-based encoding
| null |
resolved fixed
|
d5c2ead
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-08-29T20:08:59Z | 2008-08-15T17:06:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
|
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"));
}
}
};
}
public ICompilerRequestor getBatchRequestor() {
return new ICompilerRequestor() {
public void acceptResult(CompilationResult unitResult) {
if (!unitResult.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('/', '.');
|
244,321 |
Bug 244321 I cannot aspect code written in SJPP-based encoding
| null |
resolved fixed
|
d5c2ead
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-08-29T20:08:59Z | 2008-08-15T17:06:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
|
filename = filename.replace('/', File.separatorChar) + ".class";
try {
if (buildConfig.getOutputJar() == null) {
writeDirectoryEntry(unitResult, classFile,filename);
} else {
writeZipEntry(classFile,filename);
}
if (shouldAddAspectName) addAspectName(classname, unitResult.getFileName());
} catch (IOException ex) {
IMessage message = EclipseAdapterUtils.makeErrorMessage(
new String(unitResult.fileName),
CANT_WRITE_RESULT,
ex);
handler.handleMessage(message);
}
}
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 void writeDirectoryEntry(
|
244,321 |
Bug 244321 I cannot aspect code written in SJPP-based encoding
| null |
resolved fixed
|
d5c2ead
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-08-29T20:08:59Z | 2008-08-15T17:06:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
|
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) {
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();
}
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();
|
244,321 |
Bug 244321 I cannot aspect code written in SJPP-based encoding
| null |
resolved fixed
|
d5c2ead
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-08-29T20:08:59Z | 2008-08-15T17:06:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
|
}
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)) {
state.getAspectNamesToFileNameMap().put(name,
fileContainingAspect);
}
}
}
};
}
protected boolean proceedOnError() {
return buildConfig.getProceedOnError();
}
}
}
private void setBuildConfig(AjBuildConfig buildConfig) {
this.buildConfig = buildConfig;
if (!this.environmentSupportsIncrementalCompilation) {
this.environmentSupportsIncrementalCompilation =
|
244,321 |
Bug 244321 I cannot aspect code written in SJPP-based encoding
| null |
resolved fixed
|
d5c2ead
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-08-29T20:08:59Z | 2008-08-15T17:06:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
|
(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(); ) {
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;
}
|
244,321 |
Bug 244321 I cannot aspect code written in SJPP-based encoding
| null |
resolved fixed
|
d5c2ead
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-08-29T20:08:59Z | 2008-08-15T17:06:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
|
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();
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;
|
244,321 |
Bug 244321 I cannot aspect code written in SJPP-based encoding
| null |
resolved fixed
|
d5c2ead
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-08-29T20:08:59Z | 2008-08-15T17:06:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
|
continue;
}
} catch (IOException ioe) {
ret = "bad jar file found in " + p.getAbsolutePath() + " error: " + ioe;
}
return null;
} else {
}
}
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();
}
public void setStructureModel(IHierarchy structureModel) {
this.structureModel = structureModel;
}
/**
* Returns null if there is no structure model
*/
public IHierarchy getStructureModel() {
return structureModel;
|
244,321 |
Bug 244321 I cannot aspect code written in SJPP-based encoding
| null |
resolved fixed
|
d5c2ead
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-08-29T20:08:59Z | 2008-08-15T17:06:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
|
}
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[])
*/
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;
}
|
244,321 |
Bug 244321 I cannot aspect code written in SJPP-based encoding
| null |
resolved fixed
|
d5c2ead
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-08-29T20:08:59Z | 2008-08-15T17:06:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
|
/* (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);
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(),
|
244,321 |
Bug 244321 I cannot aspect code written in SJPP-based encoding
| null |
resolved fixed
|
d5c2ead
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-08-29T20:08:59Z | 2008-08-15T17:06:40Z |
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
|
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();
|
244,321 |
Bug 244321 I cannot aspect code written in SJPP-based encoding
| null |
resolved fixed
|
d5c2ead
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-08-29T20:08:59Z | 2008-08-15T17:06:40Z |
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 {
|
244,321 |
Bug 244321 I cannot aspect code written in SJPP-based encoding
| null |
resolved fixed
|
d5c2ead
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-08-29T20:08:59Z | 2008-08-15T17:06:40Z |
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;
}
}
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.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
* Alexandre Vasseur support for @AJ aspects
* ******************************************************************/
package org.aspectj.weaver.bcel;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.aspectj.apache.bcel.Constants;
import org.aspectj.apache.bcel.classfile.ConstantPool;
import org.aspectj.apache.bcel.classfile.Field;
import org.aspectj.apache.bcel.generic.ArrayType;
import org.aspectj.apache.bcel.generic.FieldInstruction;
import org.aspectj.apache.bcel.generic.INVOKEINTERFACE;
import org.aspectj.apache.bcel.generic.Instruction;
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
import org.aspectj.apache.bcel.generic.InstructionBranch;
import org.aspectj.apache.bcel.generic.InstructionConstants;
import org.aspectj.apache.bcel.generic.InstructionFactory;
import org.aspectj.apache.bcel.generic.InstructionHandle;
import org.aspectj.apache.bcel.generic.InstructionLV;
import org.aspectj.apache.bcel.generic.InstructionList;
import org.aspectj.apache.bcel.generic.InstructionTargeter;
import org.aspectj.apache.bcel.generic.InvokeInstruction;
import org.aspectj.apache.bcel.generic.LineNumberTag;
import org.aspectj.apache.bcel.generic.LocalVariableTag;
import org.aspectj.apache.bcel.generic.MULTIANEWARRAY;
import org.aspectj.apache.bcel.generic.ObjectType;
import org.aspectj.apache.bcel.generic.TargetLostException;
import org.aspectj.apache.bcel.generic.Type;
import org.aspectj.bridge.ISourceLocation;
import org.aspectj.weaver.Advice;
import org.aspectj.weaver.AdviceKind;
import org.aspectj.weaver.AjcMemberMaker;
import org.aspectj.weaver.BCException;
import org.aspectj.weaver.IntMap;
import org.aspectj.weaver.Member;
import org.aspectj.weaver.MemberImpl;
import org.aspectj.weaver.NameMangler;
import org.aspectj.weaver.NewConstructorTypeMunger;
import org.aspectj.weaver.NewFieldTypeMunger;
import org.aspectj.weaver.NewMethodTypeMunger;
import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedMemberImpl;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.Shadow;
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
import org.aspectj.weaver.ShadowMunger;
import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.World;
import org.aspectj.weaver.ast.Var;
import org.aspectj.weaver.patterns.AbstractPatternNodeVisitor;
import org.aspectj.weaver.patterns.AndPointcut;
import org.aspectj.weaver.patterns.NotPointcut;
import org.aspectj.weaver.patterns.OrPointcut;
import org.aspectj.weaver.patterns.ThisOrTargetPointcut;
/*
* Some fun implementation stuff:
*
* * expressionKind advice is non-execution advice
* * may have a target.
* * if the body is extracted, it will be extracted into
* a static method. The first argument to the static
* method is the target
* * advice may expose a this object, but that's the advice's
* consideration, not ours. This object will NOT be cached in another
* local, but will always come from frame zero.
*
* * non-expressionKind advice is execution advice
* * may have a this.
* * target is same as this, and is exposed that way to advice
* (i.e., target will not be cached, will always come from frame zero)
* * if the body is extracted, it will be extracted into a method
* with same static/dynamic modifier as enclosing method. If non-static,
* target of callback call will be this.
*
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
* * because of these two facts, the setup of the actual arguments (including
* possible target) callback method is the same for both kinds of advice:
* push the targetVar, if it exists (it will not exist for advice on static
* things), then push all the argVars.
*
* Protected things:
*
* * the above is sufficient for non-expressionKind advice for protected things,
* since the target will always be this.
*
* * For expressionKind things, we have to modify the signature of the callback
* method slightly. For non-static expressionKind things, we modify
* the first argument of the callback method NOT to be the type specified
* by the method/field signature (the owner), but rather we type it to
* the currentlyEnclosing type. We are guaranteed this will be fine,
* since the verifier verifies that the target is a subtype of the currently
* enclosingType.
*
* Worries:
*
* * ConstructorCalls will be weirder than all of these, since they
* supposedly don't have a target (according to AspectJ), but they clearly
* do have a target of sorts, just one that needs to be pushed on the stack,
* dupped, and not touched otherwise until the constructor runs.
*
* @author Jim Hugunin
* @author Erik Hilsdale
*
*/
public class BcelShadow extends Shadow {
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
private ShadowRange range;
private final BcelWorld world;
private final LazyMethodGen enclosingMethod;
public static boolean appliedLazyTjpOptimization;
private String actualInstructionTargetType;
/**
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
* This generates an unassociated shadow, rooted in a particular method but not rooted to any particular point in the code. It
* should be given to a rooted ShadowRange in the {@link ShadowRange#associateWithShadow(BcelShadow)} method.
*/
public BcelShadow(BcelWorld world, Kind kind, Member signature, LazyMethodGen enclosingMethod, BcelShadow enclosingShadow) {
super(kind, signature, enclosingShadow);
this.world = world;
this.enclosingMethod = enclosingMethod;
}
public BcelShadow copyInto(LazyMethodGen recipient, BcelShadow enclosing) {
BcelShadow s = new BcelShadow(world, getKind(), getSignature(), recipient, enclosing);
if (mungers.size() > 0) {
List src = mungers;
if (s.mungers == Collections.EMPTY_LIST)
s.mungers = new ArrayList();
List dest = s.mungers;
for (Iterator i = src.iterator(); i.hasNext();) {
dest.add(i.next());
}
}
return s;
}
public World getIWorld() {
return world;
}
private void deleteNewAndDup() {
final ConstantPool cpg = getEnclosingClass().getConstantPool();
int depth = 1;
InstructionHandle ih = range.getStart();
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
while (true) {
Instruction inst = ih.getInstruction();
if (inst.opcode == Constants.INVOKESPECIAL && ((InvokeInstruction) inst).getName(cpg).equals("<init>")) {
depth++;
} else if (inst.opcode == Constants.NEW) {
depth--;
if (depth == 0)
break;
} else if (inst.opcode == Constants.DUP_X2) {
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
ih.setInstruction(InstructionConstants.DUP);
}
ih = ih.getPrev();
}
InstructionHandle newHandle = ih;
InstructionHandle endHandle = newHandle.getNext();
InstructionHandle nextHandle;
if (endHandle.getInstruction().opcode == Constants.DUP) {
nextHandle = endHandle.getNext();
retargetFrom(newHandle, nextHandle);
retargetFrom(endHandle, nextHandle);
} else if (endHandle.getInstruction().opcode == Constants.DUP_X1) {
InstructionHandle dupHandle = endHandle;
endHandle = endHandle.getNext();
nextHandle = endHandle.getNext();
if (endHandle.getInstruction().opcode == Constants.SWAP) {
} else {
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
throw new RuntimeException("Unhandled kind of new " + endHandle);
}
retargetFrom(newHandle, nextHandle);
retargetFrom(dupHandle, nextHandle);
retargetFrom(endHandle, nextHandle);
} else {
endHandle = newHandle;
nextHandle = endHandle.getNext();
retargetFrom(newHandle, nextHandle);
getRange().insert(InstructionConstants.POP, Range.OutsideAfter);
}
try {
range.getBody().delete(newHandle, endHandle);
} catch (TargetLostException e) {
throw new BCException("shouldn't happen");
}
}
private void retargetFrom(InstructionHandle old, InstructionHandle fresh) {
InstructionTargeter[] sources = old.getTargetersArray();
if (sources != null) {
for (int i = sources.length - 1; i >= 0; i--) {
if (sources[i] instanceof ExceptionRange) {
ExceptionRange it = (ExceptionRange) sources[i];
System.err.println("...");
it.updateTarget(old, fresh, it.getBody());
} else {
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
sources[i].updateTarget(old, fresh);
}
}
}
}
private List badAdvice = null;
public void addAdvicePreventingLazyTjp(BcelAdvice advice) {
if (badAdvice == null)
badAdvice = new ArrayList();
badAdvice.add(advice);
}
protected void prepareForMungers() {
if (getKind() == ConstructorCall) {
if (!world.isJoinpointArrayConstructionEnabled() || !this.getSignature().getDeclaringType().isArray())
deleteNewAndDup();
initializeArgVars();
} else if (getKind() == PreInitialization) {
ShadowRange range = getRange();
range.insert(InstructionConstants.NOP, Range.InsideAfter);
} else if (getKind() == ExceptionHandler) {
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
ShadowRange range = getRange();
InstructionList body = range.getBody();
InstructionHandle start = range.getStart();
argVars = new BcelVar[1];
UnresolvedType tx = getArgType(0);
argVars[0] = genTempVar(tx, "ajc$arg0");
InstructionHandle insertedInstruction = range.insert(argVars[0].createStore(getFactory()), Range.OutsideBefore);
InstructionTargeter[] targeters = start.getTargetersArray();
for (int i = 0; i < targeters.length; i++) {
InstructionTargeter t = targeters[i];
if (t instanceof ExceptionRange) {
ExceptionRange er = (ExceptionRange) t;
er.updateTarget(start, insertedInstruction, body);
}
}
}
isThisJoinPointLazy = true;
badAdvice = null;
for (Iterator iter = mungers.iterator(); iter.hasNext();) {
ShadowMunger munger = (ShadowMunger) iter.next();
munger.specializeOn(this);
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
}
initializeThisJoinPoint();
if (thisJoinPointVar != null && !isThisJoinPointLazy && badAdvice != null && badAdvice.size() > 1) {
int valid = 0;
for (Iterator iter = badAdvice.iterator(); iter.hasNext();) {
BcelAdvice element = (BcelAdvice) iter.next();
ISourceLocation sLoc = element.getSourceLocation();
if (sLoc != null && sLoc.getLine() > 0)
valid++;
}
if (valid != 0) {
ISourceLocation[] badLocs = new ISourceLocation[valid];
int i = 0;
for (Iterator iter = badAdvice.iterator(); iter.hasNext();) {
BcelAdvice element = (BcelAdvice) iter.next();
ISourceLocation sLoc = element.getSourceLocation();
if (sLoc != null)
badLocs[i++] = sLoc;
}
world.getLint().multipleAdviceStoppingLazyTjp
.signal(new String[] { this.toString() }, getSourceLocation(), badLocs);
}
}
badAdvice = null;
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
InstructionFactory fact = getFactory();
if (getKind().argsOnStack() && argVars != null) {
if (getKind() == ExceptionHandler && range.getEnd().getNext().getInstruction().equals(InstructionConstants.POP)) {
range.getEnd().getNext().setInstruction(InstructionConstants.NOP);
} else {
range.insert(BcelRenderer.renderExprs(fact, world, argVars), Range.InsideBefore);
if (targetVar != null) {
range.insert(BcelRenderer.renderExpr(fact, world, targetVar), Range.InsideBefore);
}
if (getKind() == ConstructorCall) {
if (!world.isJoinpointArrayConstructionEnabled() || !this.getSignature().getDeclaringType().isArray()) {
range.insert(InstructionFactory.createDup(1), Range.InsideBefore);
range.insert(fact.createNew((ObjectType) BcelWorld.makeBcelType(getSignature().getDeclaringType())),
Range.InsideBefore);
}
}
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
}
}
}
public ShadowRange getRange() {
return range;
}
public void setRange(ShadowRange range) {
this.range = range;
}
private int sourceline = -1;
public int getSourceLine() {
if (sourceline != -1)
return sourceline;
Kind kind = getKind();
if ((kind == MethodExecution) || (kind == ConstructorExecution) || (kind == AdviceExecution)
|| (kind == StaticInitialization) || (kind == PreInitialization) || (kind == Initialization)) {
if (getEnclosingMethod().hasDeclaredLineNumberInfo()) {
sourceline = getEnclosingMethod().getDeclarationLineNumber();
return sourceline;
}
}
if (range == null) {
if (getEnclosingMethod().hasBody()) {
sourceline = Utility.getSourceLine(getEnclosingMethod().getBody().getStart());
return sourceline;
} else {
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
sourceline = 0;
return sourceline;
}
}
sourceline = Utility.getSourceLine(range.getStart());
if (sourceline < 0)
sourceline = 0;
return sourceline;
}
public UnresolvedType getEnclosingType() {
return getEnclosingClass().getType();
}
public LazyClassGen getEnclosingClass() {
return enclosingMethod.getEnclosingClass();
}
public BcelWorld getWorld() {
return world;
}
public static BcelShadow makeConstructorExecution(BcelWorld world, LazyMethodGen enclosingMethod,
InstructionHandle justBeforeStart) {
final InstructionList body = enclosingMethod.getBody();
BcelShadow s = new BcelShadow(world, ConstructorExecution, world.makeJoinPointSignatureFromMethod(enclosingMethod,
Member.CONSTRUCTOR), enclosingMethod, null);
ShadowRange r = new ShadowRange(body);
r.associateWithShadow(s);
r.associateWithTargets(Range.genStart(body, justBeforeStart.getNext()), Range.genEnd(body));
return s;
}
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
public static BcelShadow makeStaticInitialization(BcelWorld world, LazyMethodGen enclosingMethod) {
InstructionList body = enclosingMethod.getBody();
InstructionHandle clinitStart = body.getStart();
if (clinitStart.getInstruction() instanceof InvokeInstruction) {
InvokeInstruction ii = (InvokeInstruction) clinitStart.getInstruction();
if (ii.getName(enclosingMethod.getEnclosingClass().getConstantPool()).equals(NameMangler.AJC_PRE_CLINIT_NAME)) {
clinitStart = clinitStart.getNext();
}
}
InstructionHandle clinitEnd = body.getEnd();
}
}
BcelShadow s = new BcelShadow(world, StaticInitialization, world.makeJoinPointSignatureFromMethod(enclosingMethod,
Member.STATIC_INITIALIZATION), enclosingMethod, null);
ShadowRange r = new ShadowRange(body);
r.associateWithShadow(s);
r.associateWithTargets(Range.genStart(body, clinitStart), Range.genEnd(body, clinitEnd));
return s;
}
/**
* Make the shadow for an exception handler. Currently makes an empty shadow that only allows before advice to be woven into it.
*/
public static BcelShadow makeExceptionHandler(BcelWorld world, ExceptionRange exceptionRange, LazyMethodGen enclosingMethod,
InstructionHandle startOfHandler, BcelShadow enclosingShadow) {
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
InstructionList body = enclosingMethod.getBody();
UnresolvedType catchType = exceptionRange.getCatchType();
UnresolvedType inType = enclosingMethod.getEnclosingClass().getType();
ResolvedMemberImpl sig = MemberImpl.makeExceptionHandlerSignature(inType, catchType);
sig.setParameterNames(new String[] { findHandlerParamName(startOfHandler) });
BcelShadow s = new BcelShadow(world, ExceptionHandler, sig, enclosingMethod, enclosingShadow);
ShadowRange r = new ShadowRange(body);
r.associateWithShadow(s);
InstructionHandle start = Range.genStart(body, startOfHandler);
InstructionHandle end = Range.genEnd(body, start);
r.associateWithTargets(start, end);
exceptionRange.updateTarget(startOfHandler, start, body);
return s;
}
private static String findHandlerParamName(InstructionHandle startOfHandler) {
if (startOfHandler.getInstruction().isStoreInstruction() && startOfHandler.getNext() != null) {
int slot = startOfHandler.getInstruction().getIndex();
Iterator tIter = startOfHandler.getNext().getTargeters().iterator();
while (tIter.hasNext()) {
InstructionTargeter targeter = (InstructionTargeter) tIter.next();
if (targeter instanceof LocalVariableTag) {
LocalVariableTag t = (LocalVariableTag) targeter;
if (t.getSlot() == slot) {
return t.getName();
}
}
}
}
return "<missing>";
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
}
public static BcelShadow makeIfaceInitialization(BcelWorld world, LazyMethodGen constructor,
Member interfaceConstructorSignature) {
constructor.getBody();
BcelShadow s = new BcelShadow(world, Initialization, interfaceConstructorSignature, constructor, null);
return s;
}
public void initIfaceInitializer(InstructionHandle end) {
final InstructionList body = enclosingMethod.getBody();
ShadowRange r = new ShadowRange(body);
r.associateWithShadow(this);
InstructionHandle nop = body.insert(end, InstructionConstants.NOP);
r.associateWithTargets(Range.genStart(body, nop), Range.genEnd(body, nop));
}
{
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
world,
null);
}
/**
* Create an initialization join point associated with a constructor, but not with any body of code yet. If this is actually
* matched, it's range will be set when we inline self constructors.
*
* @param constructor The constructor starting this initialization.
*/
public static BcelShadow makeUnfinishedInitialization(BcelWorld world, LazyMethodGen constructor) {
BcelShadow ret = new BcelShadow(world, Initialization, world.makeJoinPointSignatureFromMethod(constructor,
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
Member.CONSTRUCTOR), constructor, null);
if (constructor.getEffectiveSignature() != null) {
ret.setMatchingSignature(constructor.getEffectiveSignature().getEffectiveSignature());
}
return ret;
}
public static BcelShadow makeUnfinishedPreinitialization(BcelWorld world, LazyMethodGen constructor) {
BcelShadow ret = new BcelShadow(world, PreInitialization, world.makeJoinPointSignatureFromMethod(constructor,
Member.CONSTRUCTOR), constructor, null);
if (constructor.getEffectiveSignature() != null) {
ret.setMatchingSignature(constructor.getEffectiveSignature().getEffectiveSignature());
}
return ret;
}
public static BcelShadow makeMethodExecution(BcelWorld world, LazyMethodGen enclosingMethod, boolean lazyInit) {
if (!lazyInit)
return makeMethodExecution(world, enclosingMethod);
BcelShadow s = new BcelShadow(world, MethodExecution, enclosingMethod.getMemberView(), enclosingMethod, null);
return s;
}
public void init() {
if (range != null)
return;
final InstructionList body = enclosingMethod.getBody();
ShadowRange r = new ShadowRange(body);
r.associateWithShadow(this);
r.associateWithTargets(Range.genStart(body), Range.genEnd(body));
}
public static BcelShadow makeMethodExecution(BcelWorld world, LazyMethodGen enclosingMethod) {
return makeShadowForMethod(world, enclosingMethod, MethodExecution, enclosingMethod.getMemberView()); world.
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
(
;
}
public static BcelShadow makeShadowForMethod(BcelWorld world, LazyMethodGen enclosingMethod, Shadow.Kind kind, Member sig) {
final InstructionList body = enclosingMethod.getBody();
BcelShadow s = new BcelShadow(world, kind, sig, enclosingMethod, null);
ShadowRange r = new ShadowRange(body);
r.associateWithShadow(s);
r.associateWithTargets(
Range.genStart(body), Range.genEnd(body));
return s;
}
public static BcelShadow makeAdviceExecution(BcelWorld world, LazyMethodGen enclosingMethod) {
final InstructionList body = enclosingMethod.getBody();
BcelShadow s = new BcelShadow(world, AdviceExecution, world
.makeJoinPointSignatureFromMethod(enclosingMethod, Member.ADVICE), enclosingMethod, null);
ShadowRange r = new ShadowRange(body);
r.associateWithShadow(s);
r.associateWithTargets(Range.genStart(body), Range.genEnd(body));
return s;
}
public static BcelShadow makeConstructorCall(BcelWorld world, LazyMethodGen enclosingMethod, InstructionHandle callHandle,
BcelShadow enclosingShadow) {
final InstructionList body = enclosingMethod.getBody();
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
Member sig = world.makeJoinPointSignatureForMethodInvocation(enclosingMethod.getEnclosingClass(),
(InvokeInstruction) callHandle.getInstruction());
BcelShadow s = new BcelShadow(world, ConstructorCall, sig, enclosingMethod, enclosingShadow);
ShadowRange r = new ShadowRange(body);
r.associateWithShadow(s);
r.associateWithTargets(Range.genStart(body, callHandle), Range.genEnd(body, callHandle));
retargetAllBranches(callHandle, r.getStart());
return s;
}
public static BcelShadow makeArrayConstructorCall(BcelWorld world, LazyMethodGen enclosingMethod,
InstructionHandle arrayInstruction, BcelShadow enclosingShadow) {
final InstructionList body = enclosingMethod.getBody();
Member sig = world.makeJoinPointSignatureForArrayConstruction(enclosingMethod.getEnclosingClass(), arrayInstruction);
BcelShadow s = new BcelShadow(world, ConstructorCall, sig, enclosingMethod, enclosingShadow);
ShadowRange r = new ShadowRange(body);
r.associateWithShadow(s);
r.associateWithTargets(Range.genStart(body, arrayInstruction), Range.genEnd(body, arrayInstruction));
retargetAllBranches(arrayInstruction, r.getStart());
return s;
}
public static BcelShadow makeMonitorEnter(BcelWorld world, LazyMethodGen enclosingMethod, InstructionHandle monitorInstruction,
BcelShadow enclosingShadow) {
final InstructionList body = enclosingMethod.getBody();
Member sig = world.makeJoinPointSignatureForMonitorEnter(enclosingMethod.getEnclosingClass(), monitorInstruction);
BcelShadow s = new BcelShadow(world, SynchronizationLock, sig, enclosingMethod, enclosingShadow);
ShadowRange r = new ShadowRange(body);
r.associateWithShadow(s);
r.associateWithTargets(Range.genStart(body, monitorInstruction), Range.genEnd(body, monitorInstruction));
retargetAllBranches(monitorInstruction, r.getStart());
return s;
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
}
public static BcelShadow makeMonitorExit(BcelWorld world, LazyMethodGen enclosingMethod, InstructionHandle monitorInstruction,
BcelShadow enclosingShadow) {
final InstructionList body = enclosingMethod.getBody();
Member sig = world.makeJoinPointSignatureForMonitorExit(enclosingMethod.getEnclosingClass(), monitorInstruction);
BcelShadow s = new BcelShadow(world, SynchronizationUnlock, sig, enclosingMethod, enclosingShadow);
ShadowRange r = new ShadowRange(body);
r.associateWithShadow(s);
r.associateWithTargets(Range.genStart(body, monitorInstruction), Range.genEnd(body, monitorInstruction));
retargetAllBranches(monitorInstruction, r.getStart());
return s;
}
{
world,
sig,
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
}
public static BcelShadow makeMethodCall(BcelWorld world, LazyMethodGen enclosingMethod, InstructionHandle callHandle,
BcelShadow enclosingShadow) {
final InstructionList body = enclosingMethod.getBody();
BcelShadow s = new BcelShadow(world, MethodCall, world.makeJoinPointSignatureForMethodInvocation(enclosingMethod
.getEnclosingClass(), (InvokeInstruction) callHandle.getInstruction()), enclosingMethod, enclosingShadow);
ShadowRange r = new ShadowRange(body);
r.associateWithShadow(s);
r.associateWithTargets(Range.genStart(body, callHandle), Range.genEnd(body, callHandle));
retargetAllBranches(callHandle, r.getStart());
return s;
}
public static BcelShadow makeShadowForMethodCall(BcelWorld world, LazyMethodGen enclosingMethod, InstructionHandle callHandle,
BcelShadow enclosingShadow, Kind kind, ResolvedMember sig) {
final InstructionList body = enclosingMethod.getBody();
BcelShadow s = new BcelShadow(world, kind, sig, enclosingMethod, enclosingShadow);
ShadowRange r = new ShadowRange(body);
r.associateWithShadow(s);
r.associateWithTargets(Range.genStart(body, callHandle), Range.genEnd(body, callHandle));
retargetAllBranches(callHandle, r.getStart());
return s;
}
public static BcelShadow makeFieldGet(BcelWorld world, ResolvedMember field, LazyMethodGen enclosingMethod,
InstructionHandle getHandle, BcelShadow enclosingShadow) {
final InstructionList body = enclosingMethod.getBody();
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
BcelShadow s = new BcelShadow(world, FieldGet, field,
enclosingMethod, enclosingShadow);
ShadowRange r = new ShadowRange(body);
r.associateWithShadow(s);
r.associateWithTargets(Range.genStart(body, getHandle), Range.genEnd(body, getHandle));
retargetAllBranches(getHandle, r.getStart());
return s;
}
public static BcelShadow makeFieldSet(BcelWorld world, ResolvedMember field, LazyMethodGen enclosingMethod,
InstructionHandle setHandle, BcelShadow enclosingShadow) {
final InstructionList body = enclosingMethod.getBody();
BcelShadow s = new BcelShadow(world, FieldSet, field,
enclosingMethod, enclosingShadow);
ShadowRange r = new ShadowRange(body);
r.associateWithShadow(s);
r.associateWithTargets(Range.genStart(body, setHandle), Range.genEnd(body, setHandle));
retargetAllBranches(setHandle, r.getStart());
return s;
}
public static void retargetAllBranches(InstructionHandle from, InstructionHandle to) {
InstructionTargeter[] sources = from.getTargetersArray();
if (sources != null) {
for (int i = sources.length - 1; i >= 0; i--) {
InstructionTargeter source = sources[i];
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
if (source instanceof InstructionBranch) {
source.updateTarget(from, to);
}
}
}
}
}
}
/**
* If the end of my range has no real instructions following then my context needs a return at the end.
*/
public boolean terminatesWithReturn() {
return getRange().getRealNext() == null;
}
/**
* Is arg0 occupied with the value of this
*/
public boolean arg0HoldsThis() {
if (getKind().isEnclosingKind()) {
return !getSignature().isStatic();
} else if (enclosingShadow == null) {
return !enclosingMethod.isStatic();
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
} else {
return ((BcelShadow) enclosingShadow).arg0HoldsThis();
}
}
private BcelVar thisVar = null;
private BcelVar targetVar = null;
private BcelVar[] argVars = null;
private MapkindedAnnotationVars = null;
private MapthisAnnotationVars = null;
private MaptargetAnnotationVars = null;
private Map[] argAnnotationVars = null;
private MapwithinAnnotationVars = null;
private MapwithincodeAnnotationVars = null;
public Var getThisVar() {
if (!hasThis()) {
throw new IllegalStateException("no this");
}
initializeThisVar();
return thisVar;
}
public Var getThisAnnotationVar(UnresolvedType forAnnotationType) {
if (!hasThis()) {
throw new IllegalStateException("no this");
}
initializeThisAnnotationVars();
Var v = (Var) thisAnnotationVars.get(forAnnotationType);
if (v == null)
v = new TypeAnnotationAccessVar(forAnnotationType.resolve(world), (BcelVar) getThisVar());
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
return v;
}
public Var getTargetVar() {
if (!hasTarget()) {
throw new IllegalStateException("no target");
}
initializeTargetVar();
return targetVar;
}
public Var getTargetAnnotationVar(UnresolvedType forAnnotationType) {
if (!hasTarget()) {
throw new IllegalStateException("no target");
}
initializeTargetAnnotationVars();
Var v = (Var) targetAnnotationVars.get(forAnnotationType);
if (v == null)
v = new TypeAnnotationAccessVar(forAnnotationType.resolve(world), (BcelVar) getTargetVar());
return v;
}
public Var getArgVar(int i) {
initializeArgVars();
return argVars[i];
}
public Var getArgAnnotationVar(int i, UnresolvedType forAnnotationType) {
initializeArgAnnotationVars();
Var v = (Var) argAnnotationVars[i].get(forAnnotationType);
if (v == null)
v = new TypeAnnotationAccessVar(forAnnotationType.resolve(world), (BcelVar) getArgVar(i));
return v;
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
}
public Var getKindedAnnotationVar(UnresolvedType forAnnotationType) {
initializeKindedAnnotationVars();
return (Var) kindedAnnotationVars.get(forAnnotationType);
}
public Var getWithinAnnotationVar(UnresolvedType forAnnotationType) {
initializeWithinAnnotationVars();
return (Var) withinAnnotationVars.get(forAnnotationType);
}
public Var getWithinCodeAnnotationVar(UnresolvedType forAnnotationType) {
initializeWithinCodeAnnotationVars();
return (Var) withincodeAnnotationVars.get(forAnnotationType);
}
private BcelVar thisJoinPointVar = null;
private boolean isThisJoinPointLazy;
private int lazyTjpConsumers = 0;
private BcelVar thisJoinPointStaticPartVar = null;
public final Var getThisJoinPointStaticPartVar() {
return getThisJoinPointStaticPartBcelVar();
}
public final Var getThisEnclosingJoinPointStaticPartVar() {
return getThisEnclosingJoinPointStaticPartBcelVar();
}
public void requireThisJoinPoint(boolean hasGuardTest, boolean isAround) {
if (!isAround) {
if (!hasGuardTest) {
isThisJoinPointLazy = false;
} else {
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
lazyTjpConsumers++;
}
}
}
if (thisJoinPointVar == null) {
thisJoinPointVar = genTempVar(UnresolvedType.forName("org.aspectj.lang.JoinPoint"));
}
}
public Var getThisJoinPointVar() {
requireThisJoinPoint(false, false);
return thisJoinPointVar;
}
void initializeThisJoinPoint() {
if (thisJoinPointVar == null)
return;
if (isThisJoinPointLazy) {
isThisJoinPointLazy = checkLazyTjp();
}
if (isThisJoinPointLazy) {
appliedLazyTjpOptimization = true;
createThisJoinPoint();
if (lazyTjpConsumers == 1)
return;
InstructionFactory fact = getFactory();
InstructionList il = new InstructionList();
il.append(InstructionConstants.ACONST_NULL);
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
il.append(thisJoinPointVar.createStore(fact));
range.insert(il, Range.OutsideBefore);
} else {
appliedLazyTjpOptimization = false;
InstructionFactory fact = getFactory();
InstructionList il = createThisJoinPoint();
il.append(thisJoinPointVar.createStore(fact));
range.insert(il, Range.OutsideBefore);
}
}
private boolean checkLazyTjp() {
for (Iterator i = mungers.iterator(); i.hasNext();) {
ShadowMunger munger = (ShadowMunger) i.next();
if (munger instanceof Advice) {
if (((Advice) munger).getKind() == AdviceKind.Around) {
if (munger.getSourceLocation() != null) {
if (world.getLint().canNotImplementLazyTjp.isEnabled()) {
world.getLint().canNotImplementLazyTjp.signal(new String[] { toString() }, getSourceLocation(),
new ISourceLocation[] { munger.getSourceLocation() });
}
}
return false;
}
}
}
return true;
}
InstructionList loadThisJoinPoint() {
InstructionFactory fact = getFactory();
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
InstructionList il = new InstructionList();
if (isThisJoinPointLazy) {
il.append(createThisJoinPoint());
if (lazyTjpConsumers > 1) {
il.append(thisJoinPointVar.createStore(fact));
InstructionHandle end = il.append(thisJoinPointVar.createLoad(fact));
il.insert(InstructionFactory.createBranchInstruction(Constants.IFNONNULL, end));
il.insert(thisJoinPointVar.createLoad(fact));
}
} else {
thisJoinPointVar.appendLoad(il, fact);
}
return il;
}
InstructionList createThisJoinPoint() {
InstructionFactory fact = getFactory();
InstructionList il = new InstructionList();
BcelVar staticPart = getThisJoinPointStaticPartBcelVar();
staticPart.appendLoad(il, fact);
if (hasThis()) {
((BcelVar) getThisVar()).appendLoad(il, fact);
} else {
il.append(InstructionConstants.ACONST_NULL);
}
if (hasTarget()) {
((BcelVar) getTargetVar()).appendLoad(il, fact);
} else {
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
il.append(InstructionConstants.ACONST_NULL);
}
switch (getArgCount()) {
case 0:
il.append(fact.createInvoke("org.aspectj.runtime.reflect.Factory", "makeJP", LazyClassGen.tjpType, new Type[] {
LazyClassGen.staticTjpType, Type.OBJECT, Type.OBJECT }, Constants.INVOKESTATIC));
break;
case 1:
((BcelVar) getArgVar(0)).appendLoadAndConvert(il, fact, world.getCoreType(ResolvedType.OBJECT));
il.append(fact.createInvoke("org.aspectj.runtime.reflect.Factory", "makeJP", LazyClassGen.tjpType, new Type[] {
LazyClassGen.staticTjpType, Type.OBJECT, Type.OBJECT, Type.OBJECT }, Constants.INVOKESTATIC));
break;
case 2:
((BcelVar) getArgVar(0)).appendLoadAndConvert(il, fact, world.getCoreType(ResolvedType.OBJECT));
((BcelVar) getArgVar(1)).appendLoadAndConvert(il, fact, world.getCoreType(ResolvedType.OBJECT));
il.append(fact.createInvoke("org.aspectj.runtime.reflect.Factory", "makeJP", LazyClassGen.tjpType, new Type[] {
LazyClassGen.staticTjpType, Type.OBJECT, Type.OBJECT, Type.OBJECT, Type.OBJECT }, Constants.INVOKESTATIC));
break;
default:
il.append(makeArgsObjectArray());
il.append(fact.createInvoke("org.aspectj.runtime.reflect.Factory", "makeJP", LazyClassGen.tjpType, new Type[] {
LazyClassGen.staticTjpType, Type.OBJECT, Type.OBJECT, new ArrayType(Type.OBJECT, 1) }, Constants.INVOKESTATIC));
break;
}
return il;
}
/**
* Get the Var for the jpStaticPart
*
* @return
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
*/
public BcelVar getThisJoinPointStaticPartBcelVar() {
return getThisJoinPointStaticPartBcelVar(false);
}
/**
* Get the Var for the xxxxJpStaticPart, xxx = this or enclosing
*
* @param isEnclosingJp true to have the enclosingJpStaticPart
* @return
*/
public BcelVar getThisJoinPointStaticPartBcelVar(final boolean isEnclosingJp) {
if (thisJoinPointStaticPartVar == null) {
Field field = getEnclosingClass().getTjpField(this, isEnclosingJp);
ResolvedType sjpType = null;
if (world.isTargettingAspectJRuntime12()) {
sjpType = world.getCoreType(UnresolvedType.JOINPOINT_STATICPART);
} else {
sjpType = isEnclosingJp ? world.getCoreType(UnresolvedType.JOINPOINT_ENCLOSINGSTATICPART) : world
.getCoreType(UnresolvedType.JOINPOINT_STATICPART);
}
thisJoinPointStaticPartVar = new BcelFieldRef(sjpType, getEnclosingClass().getClassName(), field.getName());
}
return thisJoinPointStaticPartVar;
}
/**
* Get the Var for the enclosingJpStaticPart
*
* @return
*/
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
public BcelVar getThisEnclosingJoinPointStaticPartBcelVar() {
if (enclosingShadow == null) {
return getThisJoinPointStaticPartBcelVar(true);
} else {
return ((BcelShadow) enclosingShadow).getThisJoinPointStaticPartBcelVar(true);
}
}
public Member getEnclosingCodeSignature() {
if (getKind().isEnclosingKind()) {
return getSignature();
} else if (getKind() == Shadow.PreInitialization) {
return getSignature();
} else if (enclosingShadow == null) {
return getEnclosingMethod().getMemberView();
} else {
return enclosingShadow.getSignature();
}
}
private InstructionList makeArgsObjectArray() {
InstructionFactory fact = getFactory();
BcelVar arrayVar = genTempVar(UnresolvedType.OBJECTARRAY);
final InstructionList il = new InstructionList();
int alen = getArgCount();
il.append(Utility.createConstant(fact, alen));
il.append(fact.createNewArray(Type.OBJECT, (short) 1));
arrayVar.appendStore(il, fact);
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
int stateIndex = 0;
for (int i = 0, len = getArgCount(); i < len; i++) {
arrayVar.appendConvertableArrayStore(il, fact, stateIndex, (BcelVar) getArgVar(i));
stateIndex++;
}
arrayVar.appendLoad(il, fact);
return il;
}
/*
* initializing this is doesn't do anything, because this is protected from side-effects, so we don't need to copy its location
*/
private void initializeThisVar() {
if (thisVar != null)
return;
thisVar = new BcelVar(getThisType().resolve(world), 0);
thisVar.setPositionInAroundState(0);
}
public void initializeTargetVar() {
InstructionFactory fact = getFactory();
if (targetVar != null)
return;
if (getKind().isTargetSameAsThis()) {
if (hasThis())
initializeThisVar();
targetVar = thisVar;
} else {
initializeArgVars();
UnresolvedType type = getTargetType();
type = ensureTargetTypeIsCorrect(type);
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
targetVar = genTempVar(type, "ajc$target");
range.insert(targetVar.createStore(fact), Range.OutsideBefore);
targetVar.setPositionInAroundState(hasThis() ? 1 : 0);
}
}
/*
* PR 72528 This method double checks the target type under certain conditions. The Java 1.4 compilers seem to take calls to
* clone methods on array types and create bytecode that looks like clone is being called on Object. If we advise a clone call
* with around advice we extract the call into a helper method which we can then refer to. Because the type in the bytecode for
* the call to clone is Object we create a helper method with an Object parameter - this is not correct as we have lost the fact
* that the actual type is an array type. If we don't do the check below we will create code that fails java verification. This
* method checks for the peculiar set of conditions and if they are true, it has a sneak peek at the code before the call to see
* what is on the stack.
*/
public UnresolvedType ensureTargetTypeIsCorrect(UnresolvedType tx) {
Member msig = getSignature();
if (msig.getArity() == 0 && getKind() == MethodCall && msig.getName().charAt(0) == 'c' && tx.equals(ResolvedType.OBJECT)
&& msig.getReturnType().equals(ResolvedType.OBJECT) && msig.getName().equals("clone")) {
InstructionHandle searchPtr = range.getStart().getPrev();
while (Range.isRangeHandle(searchPtr) || searchPtr.getInstruction().isStoreInstruction()) {
searchPtr = searchPtr.getPrev();
}
if (searchPtr.getInstruction().isLoadInstruction()) {
LocalVariableTag lvt = LazyMethodGen.getLocalVariableTag(searchPtr, searchPtr.getInstruction().getIndex());
if (lvt != null)
return UnresolvedType.forSignature(lvt.getType());
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
}
if (searchPtr.getInstruction() instanceof FieldInstruction) {
FieldInstruction si = (FieldInstruction) searchPtr.getInstruction();
Type t = si.getFieldType(getEnclosingClass().getConstantPool());
return BcelWorld.fromBcel(t);
}
if (searchPtr.getInstruction().opcode == Constants.ANEWARRAY) {
return BcelWorld.fromBcel(new ArrayType(Type.OBJECT, 1));
}
if (searchPtr.getInstruction() instanceof MULTIANEWARRAY) {
MULTIANEWARRAY ana = (MULTIANEWARRAY) searchPtr.getInstruction();
return BcelWorld.fromBcel(new ArrayType(Type.OBJECT, ana.getDimensions()));
}
throw new BCException("Can't determine real target of clone() when processing instruction "
+ searchPtr.getInstruction() + ". Perhaps avoid selecting clone with your pointcut?");
}
return tx;
}
public void initializeArgVars() {
if (argVars != null)
return;
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
InstructionFactory fact = getFactory();
int len = getArgCount();
argVars = new BcelVar[len];
int positionOffset = (hasTarget() ? 1 : 0) + ((hasThis() && !getKind().isTargetSameAsThis()) ? 1 : 0);
if (getKind().argsOnStack()) {
for (int i = len - 1; i >= 0; i--) {
UnresolvedType type = getArgType(i);
BcelVar tmp = genTempVar(type, "ajc$arg" + i);
range.insert(tmp.createStore(getFactory()), Range.OutsideBefore);
int position = i;
position += positionOffset;
tmp.setPositionInAroundState(position);
argVars[i] = tmp;
}
} else {
int index = 0;
if (arg0HoldsThis())
index++;
for (int i = 0; i < len; i++) {
UnresolvedType type = getArgType(i);
BcelVar tmp = genTempVar(type, "ajc$arg" + i);
range.insert(tmp.createCopyFrom(fact, index), Range.OutsideBefore);
argVars[i] = tmp;
int position = i;
position += positionOffset;
tmp.setPositionInAroundState(position);
index += type.getSize();
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
}
}
}
public void initializeForAroundClosure() {
initializeArgVars();
if (hasTarget())
initializeTargetVar();
if (hasThis())
initializeThisVar();
}
public void initializeThisAnnotationVars() {
if (thisAnnotationVars != null)
return;
thisAnnotationVars = new HashMap();
}
public void initializeTargetAnnotationVars() {
if (targetAnnotationVars != null)
return;
if (getKind().isTargetSameAsThis()) {
if (hasThis())
initializeThisAnnotationVars();
targetAnnotationVars = thisAnnotationVars;
} else {
targetAnnotationVars = new HashMap();
ResolvedType[] rtx = this.getTargetType().resolve(world).getAnnotationTypes();
for (int i = 0; i < rtx.length; i++) {
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
ResolvedType typeX = rtx[i];
targetAnnotationVars.put(typeX, new TypeAnnotationAccessVar(typeX, (BcelVar) getTargetVar()));
}
}
}
public void initializeArgAnnotationVars() {
if (argAnnotationVars != null)
return;
int numArgs = getArgCount();
argAnnotationVars = new Map[numArgs];
for (int i = 0; i < argAnnotationVars.length; i++) {
argAnnotationVars[i] = new HashMap();
}
}
protected ResolvedMember getRelevantMember(ResolvedMember foundMember, Member relevantMember, ResolvedType relevantType) {
if (foundMember != null) {
return foundMember;
}
foundMember = getSignature().resolve(world);
if (foundMember == null && relevantMember != null) {
foundMember = relevantType.lookupMemberWithSupersAndITDs(relevantMember);
}
List mungers = relevantType.resolve(world).getInterTypeMungers();
for (Iterator iter = mungers.iterator(); iter.hasNext();) {
BcelTypeMunger typeMunger = (BcelTypeMunger) iter.next();
if (typeMunger.getMunger() instanceof NewMethodTypeMunger || typeMunger.getMunger() instanceof NewConstructorTypeMunger) {
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
ResolvedMember fakerm = typeMunger.getSignature();
if (fakerm.getName().equals(getSignature().getName())
&& fakerm.getParameterSignature().equals(getSignature().getParameterSignature())) {
if (foundMember.getKind() == ResolvedMember.CONSTRUCTOR) {
foundMember = AjcMemberMaker.interConstructor(relevantType, foundMember, typeMunger.getAspectType());
} else {
foundMember = AjcMemberMaker.interMethod(foundMember, typeMunger.getAspectType(), false);
}
return foundMember;
}
}
}
return foundMember;
}
protected ResolvedType[] getAnnotations(ResolvedMember foundMember, Member relevantMember, ResolvedType relevantType) {
if (foundMember == null) {
List mungers = relevantType.resolve(world).getInterTypeMungers();
for (Iterator iter = mungers.iterator(); iter.hasNext();) {
BcelTypeMunger typeMunger = (BcelTypeMunger) iter.next();
if (typeMunger.getMunger() instanceof NewMethodTypeMunger
|| typeMunger.getMunger() instanceof NewConstructorTypeMunger) {
ResolvedMember fakerm = typeMunger.getSignature();
ResolvedMember ajcMethod = (getSignature().getKind() == ResolvedMember.CONSTRUCTOR ? AjcMemberMaker
.postIntroducedConstructor(typeMunger.getAspectType(), fakerm.getDeclaringType(), fakerm
.getParameterTypes()) : AjcMemberMaker
.interMethodDispatcher(fakerm, typeMunger.getAspectType()));
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
ResolvedMember rmm = findMethod(typeMunger.getAspectType(), ajcMethod);
if (fakerm.getName().equals(getSignature().getName())
&& fakerm.getParameterSignature().equals(getSignature().getParameterSignature())) {
relevantType = typeMunger.getAspectType();
foundMember = rmm;
return foundMember.getAnnotationTypes();
}
}
}
foundMember = relevantType.lookupMemberWithSupersAndITDs(relevantMember);
if (foundMember == null) {
throw new IllegalStateException("Couldn't find member " + relevantMember + " for type " + relevantType);
}
}
return foundMember.getAnnotationTypes();
}
/**
* By determining what "kind" of shadow we are, we can find out the annotations on the appropriate element (method, field,
* constructor, type). Then create one BcelVar entry in the map for each annotation, keyed by annotation type.
*/
public void initializeKindedAnnotationVars() {
if (kindedAnnotationVars != null)
return;
kindedAnnotationVars = new HashMap();
ResolvedType[] annotations = null;
Member shadowSignature = getSignature();
Member annotationHolder = getSignature();
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
ResolvedType relevantType = shadowSignature.getDeclaringType().resolve(world);
if (relevantType.isRawType() || relevantType.isParameterizedType())
relevantType = relevantType.getGenericType();
if (getKind() == Shadow.StaticInitialization) {
annotations = relevantType.resolve(world).getAnnotationTypes();
} else if (getKind() == Shadow.MethodCall || getKind() == Shadow.ConstructorCall) {
ResolvedMember foundMember = findMethod2(relevantType.resolve(world).getDeclaredMethods(), getSignature());
annotations = getAnnotations(foundMember, shadowSignature, relevantType);
annotationHolder = getRelevantMember(foundMember, shadowSignature, relevantType);
relevantType = annotationHolder.getDeclaringType().resolve(world);
} else if (getKind() == Shadow.FieldSet || getKind() == Shadow.FieldGet) {
annotationHolder = findField(relevantType.getDeclaredFields(), getSignature());
if (annotationHolder == null) {
List mungers = relevantType.resolve(world).getInterTypeMungers();
for (Iterator iter = mungers.iterator(); iter.hasNext();) {
BcelTypeMunger typeMunger = (BcelTypeMunger) iter.next();
if (typeMunger.getMunger() instanceof NewFieldTypeMunger) {
ResolvedMember fakerm = typeMunger.getSignature();
ResolvedMember ajcMethod = AjcMemberMaker.interFieldInitializer(fakerm, typeMunger.getAspectType());
ResolvedMember rmm = findMethod(typeMunger.getAspectType(), ajcMethod);
if (fakerm.equals(getSignature())) {
relevantType = typeMunger.getAspectType();
annotationHolder = rmm;
}
}
}
}
annotations = ((ResolvedMember) annotationHolder).getAnnotationTypes();
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
} else if (getKind() == Shadow.MethodExecution || getKind() == Shadow.ConstructorExecution
|| getKind() == Shadow.AdviceExecution) {
ResolvedMember foundMember = findMethod2(relevantType.getDeclaredMethods(), getSignature());
annotations = getAnnotations(foundMember, shadowSignature, relevantType);
annotationHolder = foundMember;
annotationHolder = getRelevantMember(foundMember, annotationHolder, relevantType);
} else if (getKind() == Shadow.ExceptionHandler) {
relevantType = getSignature().getParameterTypes()[0].resolve(world);
annotations = relevantType.getAnnotationTypes();
} else if (getKind() == Shadow.PreInitialization || getKind() == Shadow.Initialization) {
ResolvedMember found = findMethod2(relevantType.getDeclaredMethods(), getSignature());
annotations = found.getAnnotationTypes();
}
if (annotations == null) {
throw new BCException("Could not discover annotations for shadow: " + getKind());
}
for (int i = 0; i < annotations.length; i++) {
ResolvedType annotationType = annotations[i];
AnnotationAccessVar accessVar = new AnnotationAccessVar(getKind(), annotationType.resolve(world), relevantType,
annotationHolder);
kindedAnnotationVars.put(annotationType, accessVar);
}
}
ResolvedMember findMethod2(ResolvedMember rm[], Member sig) {
ResolvedMember found = null;
for (int i = 0; i < rm.length && found == null; i++) {
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
ResolvedMember member = rm[i];
if (member.getName().equals(sig.getName()) && member.getParameterSignature().equals(sig.getParameterSignature()))
found = member;
}
return found;
}
private ResolvedMember findMethod(ResolvedType aspectType, ResolvedMember ajcMethod) {
ResolvedMember decMethods[] = aspectType.getDeclaredMethods();
for (int i = 0; i < decMethods.length; i++) {
ResolvedMember member = decMethods[i];
if (member.equals(ajcMethod))
return member;
}
return null;
}
private ResolvedMember findField(ResolvedMember[] members, Member lookingFor) {
for (int i = 0; i < members.length; i++) {
ResolvedMember member = members[i];
if (member.getName().equals(getSignature().getName()) && member.getType().equals(getSignature().getType())) {
return member;
}
}
return null;
}
public void initializeWithinAnnotationVars() {
if (withinAnnotationVars != null)
return;
withinAnnotationVars = new HashMap();
ResolvedType[] annotations = getEnclosingType().resolve(world).getAnnotationTypes();
for (int i = 0; i < annotations.length; i++) {
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
ResolvedType ann = annotations[i];
Kind k = Shadow.StaticInitialization;
withinAnnotationVars.put(ann, new AnnotationAccessVar(k, ann, getEnclosingType(), null));
}
}
public void initializeWithinCodeAnnotationVars() {
if (withincodeAnnotationVars != null)
return;
withincodeAnnotationVars = new HashMap();
ResolvedType[] annotations = getEnclosingMethod().getMemberView().getAnnotationTypes();
for (int i = 0; i < annotations.length; i++) {
ResolvedType ann = annotations[i];
Kind k = (getEnclosingMethod().getMemberView().getKind() == Member.CONSTRUCTOR ? Shadow.ConstructorExecution
: Shadow.MethodExecution);
withincodeAnnotationVars.put(ann, new AnnotationAccessVar(k, ann, getEnclosingType(), getEnclosingCodeSignature()));
}
}
void weaveBefore(BcelAdvice munger) {
range.insert(munger.getAdviceInstructions(this, null, range.getRealStart()), Range.InsideBefore);
}
public void weaveAfter(BcelAdvice munger) {
weaveAfterThrowing(munger, UnresolvedType.THROWABLE);
weaveAfterReturning(munger);
}
/**
* The basic strategy here is to add a set of instructions at the end of the shadow range that dispatch the advice, and then
* return whatever the shadow was going to return anyway.
*
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
* To achieve this, we note all the return statements in the advice, and replace them with code that: 1) stores the return value
* on top of the stack in a temp var 2) jumps to the start of our advice block 3) restores the return value at the end of the
* advice block before ultimately returning
*
* We also need to bind the return value into a returning parameter, if the advice specified one.
*/
public void weaveAfterReturning(BcelAdvice munger) {
List returns = findReturnInstructions();
boolean hasReturnInstructions = !returns.isEmpty();
InstructionList retList = new InstructionList();
BcelVar returnValueVar = null;
if (hasReturnInstructions) {
returnValueVar = generateReturnInstructions(returns, retList);
} else {
retList.append(InstructionConstants.NOP);
}
InstructionList advice = getAfterReturningAdviceDispatchInstructions(munger, retList.getStart());
if (hasReturnInstructions) {
InstructionHandle gotoTarget = advice.getStart();
for (Iterator i = returns.iterator(); i.hasNext();) {
InstructionHandle ih = (InstructionHandle) i.next();
retargetReturnInstruction(munger.hasExtraParameter(), returnValueVar, gotoTarget, ih);
}
}
range.append(advice);
range.append(retList);
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
}
/**
* @return a list of all the return instructions in the range of this shadow
*/
private List findReturnInstructions() {
List returns = new ArrayList();
for (InstructionHandle ih = range.getStart(); ih != range.getEnd(); ih = ih.getNext()) {
if (ih.getInstruction().isReturnInstruction()) {
returns.add(ih);
}
}
return returns;
}
/**
* Given a list containing all the return instruction handles for this shadow, finds the last return instruction and copies it,
* making this the ultimate return. If the shadow has a non-void return type, we also create a temporary variable to hold the
* return value, and load the value from this var before returning (see pr148007 for why we do this - it works around a JRockit
* bug, and is also closer to what javac generates)
*
* Sometimes the 'last return' isnt the right one - some rogue code can include the real return from the body of a subroutine
* that exists at the end of the method. In this case the last return is RETURN but that may not be correct for a method with a
* non-void return type... pr151673
*
* @param returns list of all the return instructions in the shadow
* @param returnInstructions instruction list into which the return instructions should be generated
* @return the variable holding the return value, if needed
*/
private BcelVar generateReturnInstructions(List returns, InstructionList returnInstructions) {
BcelVar returnValueVar = null;
if (this.hasANonVoidReturnType()) {
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
Instruction newReturnInstruction = null;
int i = returns.size() - 1;
while (newReturnInstruction == null && i >= 0) {
InstructionHandle ih = (InstructionHandle) returns.get(i);
if (ih.getInstruction().opcode != Constants.RETURN) {
newReturnInstruction = Utility.copyInstruction(ih.getInstruction());
}
i--;
}
returnValueVar = genTempVar(this.getReturnType());
returnValueVar.appendLoad(returnInstructions, getFactory());
returnInstructions.append(newReturnInstruction);
} else {
InstructionHandle lastReturnHandle = (InstructionHandle) returns.get(returns.size() - 1);
Instruction newReturnInstruction = Utility.copyInstruction(lastReturnHandle.getInstruction());
returnInstructions.append(newReturnInstruction);
}
return returnValueVar;
}
/**
* @return true, iff this shadow returns a value
*/
private boolean hasANonVoidReturnType() {
return this.getReturnType() != ResolvedType.VOID;
}
/**
* Get the list of instructions used to dispatch to the after advice
*
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
* @param munger
* @param firstInstructionInReturnSequence
* @return
*/
private InstructionList getAfterReturningAdviceDispatchInstructions(BcelAdvice munger,
InstructionHandle firstInstructionInReturnSequence) {
InstructionList advice = new InstructionList();
BcelVar tempVar = null;
if (munger.hasExtraParameter()) {
tempVar = insertAdviceInstructionsForBindingReturningParameter(advice);
}
advice.append(munger.getAdviceInstructions(this, tempVar, firstInstructionInReturnSequence));
return advice;
}
/**
* If the after() returning(Foo f) form is used, bind the return value to the parameter. If the shadow returns void, bind null.
*
* @param advice
* @return
*/
private BcelVar insertAdviceInstructionsForBindingReturningParameter(InstructionList advice) {
BcelVar tempVar;
UnresolvedType tempVarType = getReturnType();
if (tempVarType.equals(ResolvedType.VOID)) {
tempVar = genTempVar(UnresolvedType.OBJECT);
advice.append(InstructionConstants.ACONST_NULL);
tempVar.appendStore(advice, getFactory());
} else {
tempVar = genTempVar(tempVarType);
advice.append(InstructionFactory.createDup(tempVarType.getSize()));
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
tempVar.appendStore(advice, getFactory());
}
return tempVar;
}
/**
* Helper method for weaveAfterReturning
*
* Each return instruction in the method body is retargeted by calling this method. The return instruction is replaced by up to
* three instructions: 1) if the shadow returns a value, and that value is bound to an after returning parameter, then we DUP
* the return value on the top of the stack 2) if the shadow returns a value, we store it in the returnValueVar (it will be
* retrieved from here when we ultimately return after the advice dispatch) 3) if the return was the last instruction, we add a
* NOP (it will fall through to the advice dispatch), otherwise we add a GOTO that branches to the supplied gotoTarget (start of
* the advice dispatch)
*/
private void retargetReturnInstruction(boolean hasReturningParameter, BcelVar returnValueVar, InstructionHandle gotoTarget,
InstructionHandle returnHandle) {
InstructionList newInstructions = new InstructionList();
if (returnValueVar != null) {
if (hasReturningParameter) {
newInstructions.append(InstructionFactory.createDup(this.getReturnType().getSize()));
}
returnValueVar.appendStore(newInstructions, getFactory());
}
if (!isLastInstructionInRange(returnHandle, range)) {
newInstructions.append(InstructionFactory.createBranchInstruction(Constants.GOTO, gotoTarget));
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
}
if (newInstructions.isEmpty()) {
newInstructions.append(InstructionConstants.NOP);
}
Utility.replaceInstruction(returnHandle, newInstructions, enclosingMethod);
}
private boolean isLastInstructionInRange(InstructionHandle ih, ShadowRange aRange) {
return ih.getNext() == aRange.getEnd();
}
public void weaveAfterThrowing(BcelAdvice munger, UnresolvedType catchType) {
if (getRange().getStart().getNext() == getRange().getEnd())
return;
InstructionFactory fact = getFactory();
InstructionList handler = new InstructionList();
BcelVar exceptionVar = genTempVar(catchType);
exceptionVar.appendStore(handler, fact);
pr62642
if (this.getEnclosingMethod().getName().equals("<clinit>")) {
ResolvedType eiieType = world.resolve("java.lang.ExceptionInInitializerError");
ObjectType eiieBcelType = (ObjectType) BcelWorld.makeBcelType(eiieType);
InstructionList ih = new InstructionList(InstructionConstants.NOP);
handler.append(exceptionVar.createLoad(fact));
handler.append(fact.createInstanceOf(eiieBcelType));
InstructionBranch bi = InstructionFactory.createBranchInstruction(Constants.IFEQ, ih.getStart());
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
handler.append(bi);
handler.append(exceptionVar.createLoad(fact));
handler.append(fact.createCheckCast(eiieBcelType));
handler.append(InstructionConstants.ATHROW);
handler.append(ih);
}
InstructionList endHandler = new InstructionList(exceptionVar.createLoad(fact));
handler.append(munger.getAdviceInstructions(this, exceptionVar, endHandler.getStart()));
handler.append(endHandler);
handler.append(InstructionConstants.ATHROW);
InstructionHandle handlerStart = handler.getStart();
if (isFallsThrough()) {
InstructionHandle jumpTarget = handler.append(InstructionConstants.NOP);
handler.insert(InstructionFactory.createBranchInstruction(Constants.GOTO, jumpTarget));
}
InstructionHandle protectedEnd = handler.getStart();
range.insert(handler, Range.InsideAfter);
enclosingMethod.addExceptionHandler(range.getStart().getNext(), protectedEnd.getPrev(), handlerStart,
(ObjectType) BcelWorld.makeBcelType(catchType),
getKind().hasHighPriorityExceptions());
}
public void weaveSoftener(BcelAdvice munger, UnresolvedType catchType) {
if (getRange().getStart().getNext() == getRange().getEnd())
return;
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
InstructionFactory fact = getFactory();
InstructionList handler = new InstructionList();
InstructionList rtExHandler = new InstructionList();
BcelVar exceptionVar = genTempVar(catchType);
handler.append(fact.createNew(NameMangler.SOFT_EXCEPTION_TYPE));
handler.append(InstructionFactory.createDup(1));
handler.append(exceptionVar.createLoad(fact));
handler.append(fact.createInvoke(NameMangler.SOFT_EXCEPTION_TYPE, "<init>", Type.VOID, new Type[] { Type.THROWABLE },
Constants.INVOKESPECIAL));
handler.append(InstructionConstants.ATHROW);
exceptionVar.appendStore(rtExHandler, fact);
aload_1
rtExHandler.append(exceptionVar.createLoad(fact));
rtExHandler.append(fact.createInstanceOf(new ObjectType("java.lang.RuntimeException")));
rtExHandler.append(InstructionFactory.createBranchInstruction(Constants.IFEQ, handler.getStart()));
aload_1
rtExHandler.append(exceptionVar.createLoad(fact));
athrow
rtExHandler.append(InstructionFactory.ATHROW);
InstructionHandle handlerStart = rtExHandler.getStart();
if (isFallsThrough()) {
InstructionHandle jumpTarget = range.getEnd();
rtExHandler.insert(InstructionFactory.createBranchInstruction(Constants.GOTO, jumpTarget));
}
rtExHandler.append(handler);
InstructionHandle protectedEnd = rtExHandler.getStart();
range.insert(rtExHandler, Range.InsideAfter);
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
enclosingMethod.addExceptionHandler(range.getStart().getNext(), protectedEnd.getPrev(), handlerStart,
(ObjectType) BcelWorld.makeBcelType(catchType),
getKind().hasHighPriorityExceptions());
}
public void weavePerObjectEntry(final BcelAdvice munger, final BcelVar onVar) {
final InstructionFactory fact = getFactory();
InstructionList entryInstructions = new InstructionList();
InstructionList entrySuccessInstructions = new InstructionList();
onVar.appendLoad(entrySuccessInstructions, fact);
entrySuccessInstructions
.append(Utility.createInvoke(fact, world, AjcMemberMaker.perObjectBind(munger.getConcreteAspect())));
InstructionList testInstructions = munger.getTestInstructions(this, entrySuccessInstructions.getStart(), range
.getRealStart(), entrySuccessInstructions.getStart());
entryInstructions.append(testInstructions);
entryInstructions.append(entrySuccessInstructions);
range.insert(entryInstructions, Range.InsideBefore);
}
/**
* Causes the aspect instance to be *set* for later retrievable through localAspectof()/aspectOf()
*/
public void weavePerTypeWithinAspectInitialization(final BcelAdvice munger, UnresolvedType t) {
if (t.resolve(world).isInterface())
return;
final InstructionFactory fact = getFactory();
InstructionList entryInstructions = new InstructionList();
InstructionList entrySuccessInstructions = new InstructionList();
BcelWorld.getBcelObjectType(munger.getConcreteAspect());
String aspectname = munger.getConcreteAspect().getName();
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
String ptwField = NameMangler.perTypeWithinFieldForTarget(munger.getConcreteAspect());
entrySuccessInstructions.append(InstructionFactory.PUSH(fact.getConstantPool(), t.getName()));
entrySuccessInstructions.append(fact.createInvoke(aspectname, "ajc$createAspectInstance", new ObjectType(aspectname),
new Type[] { new ObjectType("java.lang.String") }, Constants.INVOKESTATIC));
entrySuccessInstructions.append(fact.createPutStatic(t.getName(), ptwField, new ObjectType(aspectname)));
entryInstructions.append(entrySuccessInstructions);
range.insert(entryInstructions, Range.InsideBefore);
}
public void weaveCflowEntry(final BcelAdvice munger, final Member cflowField) {
final boolean isPer = munger.getKind() == AdviceKind.PerCflowBelowEntry || munger.getKind() == AdviceKind.PerCflowEntry;
final Type objectArrayType = new ArrayType(Type.OBJECT, 1);
final InstructionFactory fact = getFactory();
final BcelVar testResult = genTempVar(ResolvedType.BOOLEAN);
InstructionList entryInstructions = new InstructionList();
{
InstructionList entrySuccessInstructions = new InstructionList();
if (munger.hasDynamicTests()) {
entryInstructions.append(Utility.createConstant(fact, 0));
testResult.appendStore(entryInstructions, fact);
entrySuccessInstructions.append(Utility.createConstant(fact, 1));
testResult.appendStore(entrySuccessInstructions, fact);
}
if (isPer) {
entrySuccessInstructions.append(fact.createInvoke(munger.getConcreteAspect().getName(),
NameMangler.PERCFLOW_PUSH_METHOD, Type.VOID, new Type[] {}, Constants.INVOKESTATIC));
} else {
BcelVar[] cflowStateVars = munger.getExposedStateAsBcelVars(false);
if (cflowStateVars.length == 0) {
if (!cflowField.getType().getName().endsWith("CFlowCounter"))
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
throw new RuntimeException("Incorrectly attempting counter operation on stacked cflow");
entrySuccessInstructions.append(Utility.createGet(fact, cflowField));
entrySuccessInstructions.append(fact.createInvoke(NameMangler.CFLOW_COUNTER_TYPE, "inc", Type.VOID,
new Type[] {}, Constants.INVOKEVIRTUAL));
} else {
BcelVar arrayVar = genTempVar(UnresolvedType.OBJECTARRAY);
int alen = cflowStateVars.length;
entrySuccessInstructions.append(Utility.createConstant(fact, alen));
entrySuccessInstructions.append(fact.createNewArray(Type.OBJECT, (short) 1));
arrayVar.appendStore(entrySuccessInstructions, fact);
for (int i = 0; i < alen; i++) {
arrayVar.appendConvertableArrayStore(entrySuccessInstructions, fact, i, cflowStateVars[i]);
}
entrySuccessInstructions.append(Utility.createGet(fact, cflowField));
arrayVar.appendLoad(entrySuccessInstructions, fact);
entrySuccessInstructions.append(fact.createInvoke(NameMangler.CFLOW_STACK_TYPE, "push", Type.VOID,
new Type[] { objectArrayType }, Constants.INVOKEVIRTUAL));
}
}
InstructionList testInstructions = munger.getTestInstructions(this, entrySuccessInstructions.getStart(), range
.getRealStart(), entrySuccessInstructions.getStart());
entryInstructions.append(testInstructions);
entryInstructions.append(entrySuccessInstructions);
}
weaveAfter(new BcelAdvice(null, null, null, 0, 0, 0, null, null) {
public InstructionList getAdviceInstructions(BcelShadow s, BcelVar extraArgVar, InstructionHandle ifNoAdvice) {
InstructionList exitInstructions = new InstructionList();
if (munger.hasDynamicTests()) {
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
testResult.appendLoad(exitInstructions, fact);
exitInstructions.append(InstructionFactory.createBranchInstruction(Constants.IFEQ, ifNoAdvice));
}
exitInstructions.append(Utility.createGet(fact, cflowField));
if (munger.getKind() != AdviceKind.PerCflowEntry && munger.getKind() != AdviceKind.PerCflowBelowEntry
&& munger.getExposedStateAsBcelVars(false).length == 0) {
exitInstructions.append(fact.createInvoke(NameMangler.CFLOW_COUNTER_TYPE, "dec", Type.VOID, new Type[] {},
Constants.INVOKEVIRTUAL));
} else {
exitInstructions.append(fact.createInvoke(NameMangler.CFLOW_STACK_TYPE, "pop", Type.VOID, new Type[] {},
Constants.INVOKEVIRTUAL));
}
return exitInstructions;
}
});
range.insert(entryInstructions, Range.InsideBefore);
}
/*
* Implementation notes:
*
* AroundInline still extracts the instructions of the original shadow into an extracted method. This allows inlining of even
* that advice that doesn't call proceed or calls proceed more than once.
*
* It extracts the instructions of the original shadow into a method.
*
* Then it extracts the instructions of the advice into a new method defined on this enclosing class. This new method can then
* be specialized as below.
*
* Then it searches in the instructions of the advice for any call to the proceed method.
*
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
* At such a call, there is stuff on the stack representing the arguments to proceed. Pop these into the frame.
*
* Now build the stack for the call to the extracted method, taking values either from the join point state or from the new
* frame locs from proceed. Now call the extracted method. The right return value should be on the stack, so no cast is
* necessary.
*
* If only one call to proceed is made, we can re-inline the original shadow. We are not doing that presently.
*
* If the body of the advice can be determined to not alter the stack, or if this shadow doesn't care about the stack, i.e.
* method-execution, then the new method for the advice can also be re-lined. We are not doing that presently.
*/
public void weaveAroundInline(BcelAdvice munger, boolean hasDynamicTest) {
Member mungerSig = munger.getSignature();
if (mungerSig instanceof ResolvedMember) {
ResolvedMember rm = (ResolvedMember) mungerSig;
if (rm.hasBackingGenericMember())
mungerSig = rm.getBackingGenericMember();
}
ResolvedType declaringType = world.resolve(mungerSig.getDeclaringType(), true);
if (declaringType.isMissing()) {
world.getLint().cantFindType.signal(new String[] { WeaverMessages.format(
WeaverMessages.CANT_FIND_TYPE_DURING_AROUND_WEAVE, declaringType.getClassName()) }, getSourceLocation(),
new ISourceLocation[] { munger.getSourceLocation() });
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
}
ResolvedType rt = (declaringType.isParameterizedType() ? declaringType.getGenericType() : declaringType);
BcelObjectType ot = BcelWorld.getBcelObjectType(rt);
return;
}
LazyMethodGen adviceMethod = ot.getLazyClassGen().getLazyMethodGen(mungerSig);
if (!adviceMethod.getCanInline()) {
weaveAroundClosure(munger, hasDynamicTest);
return;
}
if (munger.getConcreteAspect().isAnnotationStyleAspect()) {
boolean canSeeProceedPassedToOther = false;
InstructionHandle curr = adviceMethod.getBody().getStart();
InstructionHandle end = adviceMethod.getBody().getEnd();
ConstantPool cpg = adviceMethod.getEnclosingClass().getConstantPool();
while (curr != end) {
InstructionHandle next = curr.getNext();
Instruction inst = curr.getInstruction();
if ((inst instanceof InvokeInstruction)
&& ((InvokeInstruction) inst).getSignature(cpg).indexOf("Lorg/aspectj/lang/ProceedingJoinPoint;") > 0) {
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
canSeeProceedPassedToOther = true;
break;
}
curr = next;
}
if (canSeeProceedPassedToOther) {
adviceMethod.setCanInline(false);
weaveAroundClosure(munger, hasDynamicTest);
return;
}
}
enclosingMethod.setCanInline(false);
final InstructionFactory fact = getFactory();
LazyMethodGen extractedMethod = extractMethod(NameMangler.aroundCallbackMethodName(getSignature(), getEnclosingClass()),
Modifier.PRIVATE, munger);
String adviceMethodName = NameMangler.aroundCallbackMethodName(getSignature(), getEnclosingClass()) + "$advice";
List argVarList = new ArrayList();
List proceedVarList = new ArrayList();
int extraParamOffset = 0;
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
if (thisVar != null) {
argVarList.add(thisVar);
proceedVarList.add(new BcelVar(thisVar.getType(), extraParamOffset));
extraParamOffset += thisVar.getType().getSize();
}
if (targetVar != null && targetVar != thisVar) {
argVarList.add(targetVar);
proceedVarList.add(new BcelVar(targetVar.getType(), extraParamOffset));
extraParamOffset += targetVar.getType().getSize();
}
for (int i = 0, len = getArgCount(); i < len; i++) {
argVarList.add(argVars[i]);
proceedVarList.add(new BcelVar(argVars[i].getType(), extraParamOffset));
extraParamOffset += argVars[i].getType().getSize();
}
if (thisJoinPointVar != null) {
argVarList.add(thisJoinPointVar);
proceedVarList.add(new BcelVar(thisJoinPointVar.getType(), extraParamOffset));
extraParamOffset += thisJoinPointVar.getType().getSize();
}
Type[] adviceParameterTypes = BcelWorld.makeBcelTypes(munger.getSignature().getParameterTypes());
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
adviceMethod.getArgumentTypes();
Type[] extractedMethodParameterTypes = extractedMethod.getArgumentTypes();
Type[] parameterTypes = new Type[extractedMethodParameterTypes.length + adviceParameterTypes.length + 1];
int parameterIndex = 0;
System.arraycopy(extractedMethodParameterTypes, 0, parameterTypes, parameterIndex, extractedMethodParameterTypes.length);
parameterIndex += extractedMethodParameterTypes.length;
parameterTypes[parameterIndex++] = BcelWorld.makeBcelType(adviceMethod.getEnclosingClass().getType());
System.arraycopy(adviceParameterTypes, 0, parameterTypes, parameterIndex, adviceParameterTypes.length);
LazyMethodGen localAdviceMethod = new LazyMethodGen(Modifier.PRIVATE | Modifier.FINAL | Modifier.STATIC, BcelWorld
.makeBcelType(mungerSig.getReturnType()), adviceMethodName, parameterTypes, new String[0], getEnclosingClass());
String donorFileName = adviceMethod.getEnclosingClass().getInternalFileName();
String recipientFileName = getEnclosingClass().getInternalFileName();
if (!donorFileName.equals(recipientFileName)) {
localAdviceMethod.fromFilename = donorFileName;
getEnclosingClass().addInlinedSourceFileInfo(donorFileName, adviceMethod.highestLineNumber);
}
getEnclosingClass().addMethodGen(localAdviceMethod);
int nVars = adviceMethod.getMaxLocals() + extraParamOffset;
IntMap varMap = IntMap.idMap(nVars);
for (int i = extraParamOffset; i < nVars; i++) {
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
varMap.put(i - extraParamOffset, i);
}
localAdviceMethod.getBody().insert(
BcelClassWeaver.genInlineInstructions(adviceMethod, localAdviceMethod, varMap, fact, true));
localAdviceMethod.setMaxLocals(nVars);
InstructionList advice = new InstructionList();
{
for (Iterator i = argVarList.iterator(); i.hasNext();) {
BcelVar var = (BcelVar) i.next();
var.appendLoad(advice, fact);
}
advice.append(munger.getAdviceArgSetup(this, null,
(munger.getConcreteAspect().isAnnotationStyleAspect() && munger.getDeclaringAspect() != null && munger
.getDeclaringAspect().resolve(world).isAnnotationStyleAspect()) ? this.loadThisJoinPoint()
: new InstructionList(InstructionConstants.ACONST_NULL)));
advice.append(Utility.createInvoke(fact, localAdviceMethod));
advice.append(Utility.createConversion(getFactory(), BcelWorld.makeBcelType(mungerSig.getReturnType()), extractedMethod
.getReturnType(), world.isInJava5Mode()));
if (!isFallsThrough()) {
advice.append(InstructionFactory.createReturn(extractedMethod.getReturnType()));
}
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
}
if (!hasDynamicTest) {
range.append(advice);
} else {
InstructionList afterThingie = new InstructionList(InstructionConstants.NOP);
InstructionList callback = makeCallToCallback(extractedMethod);
if (terminatesWithReturn()) {
callback.append(InstructionFactory.createReturn(extractedMethod.getReturnType()));
} else {
advice.append(InstructionFactory.createBranchInstruction(Constants.GOTO, afterThingie.getStart()));
}
range.append(munger.getTestInstructions(this, advice.getStart(), callback.getStart(), advice.getStart()));
range.append(advice);
range.append(callback);
range.append(afterThingie);
}
if (!munger.getDeclaringType().isAnnotationStyleAspect()) {
String proceedName = NameMangler.proceedMethodName(munger.getSignature().getName());
InstructionHandle curr = localAdviceMethod.getBody().getStart();
InstructionHandle end = localAdviceMethod.getBody().getEnd();
ConstantPool cpg = localAdviceMethod.getEnclosingClass().getConstantPool();
while (curr != end) {
InstructionHandle next = curr.getNext();
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
Instruction inst = curr.getInstruction();
if ((inst.opcode == Constants.INVOKESTATIC) && proceedName.equals(((InvokeInstruction) inst).getMethodName(cpg))) {
localAdviceMethod.getBody().append(curr,
getRedoneProceedCall(fact, extractedMethod, munger, localAdviceMethod, proceedVarList));
Utility.deleteInstruction(curr, localAdviceMethod);
}
curr = next;
}
} else {
InstructionHandle curr = localAdviceMethod.getBody().getStart();
InstructionHandle end = localAdviceMethod.getBody().getEnd();
ConstantPool cpg = localAdviceMethod.getEnclosingClass().getConstantPool();
while (curr != end) {
InstructionHandle next = curr.getNext();
Instruction inst = curr.getInstruction();
if ((inst instanceof INVOKEINTERFACE) && "proceed".equals(((INVOKEINTERFACE) inst).getMethodName(cpg))) {
final boolean isProceedWithArgs;
if (((INVOKEINTERFACE) inst).getArgumentTypes(cpg).length == 1) {
isProceedWithArgs = true;
} else {
isProceedWithArgs = false;
}
InstructionList insteadProceedIl = getRedoneProceedCallForAnnotationStyle(fact, extractedMethod, munger,
localAdviceMethod, proceedVarList, isProceedWithArgs);
localAdviceMethod.getBody().append(curr, insteadProceedIl);
Utility.deleteInstruction(curr, localAdviceMethod);
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
}
curr = next;
}
}
}
private InstructionList getRedoneProceedCall(InstructionFactory fact, LazyMethodGen callbackMethod, BcelAdvice munger,
LazyMethodGen localAdviceMethod, List argVarList) {
InstructionList ret = new InstructionList();
BcelVar[] adviceVars = munger.getExposedStateAsBcelVars(true);
IntMap proceedMap = makeProceedArgumentMap(adviceVars);
ResolvedType[] proceedParamTypes = world.resolve(munger.getSignature().getParameterTypes());
if (munger.getBaseParameterCount() + 1 < proceedParamTypes.length) {
int len = munger.getBaseParameterCount() + 1;
ResolvedType[] newTypes = new ResolvedType[len];
System.arraycopy(proceedParamTypes, 0, newTypes, 0, len);
proceedParamTypes = newTypes;
}
BcelVar[] proceedVars = Utility.pushAndReturnArrayOfVars(proceedParamTypes, ret, fact, localAdviceMethod);
Type[] stateTypes = callbackMethod.getArgumentTypes();
for (int i = 0, len = stateTypes.length; i < len; i++) {
Type stateType = stateTypes[i];
ResolvedType stateTypeX = BcelWorld.fromBcel(stateType).resolve(world);
if (proceedMap.hasKey(i)) {
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
proceedVars[proceedMap.get(i)].appendLoadAndConvert(ret, fact, stateTypeX);
} else {
((BcelVar) argVarList.get(i)).appendLoad(ret, fact);
}
}
ret.append(Utility.createInvoke(fact, callbackMethod));
ret.append(Utility.createConversion(fact, callbackMethod.getReturnType(), BcelWorld.makeBcelType(munger.getSignature()
.getReturnType())));
return ret;
}
}
}
}
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
}
}
}
}
/**
* Annotation style handling for inlining.
*
* Note: The proceedingjoinpoint is already on the stack (since the user was calling pjp.proceed(...)
*
* The proceed map is ignored (in terms of argument repositioning) since we have a fixed expected format for annotation style.
* The aim here is to change the proceed() call into a call to the xxx_aroundBody0 method.
*
*
*/
private InstructionList getRedoneProceedCallForAnnotationStyle(InstructionFactory fact, LazyMethodGen callbackMethod,
BcelAdvice munger, LazyMethodGen localAdviceMethod, List argVarList, boolean isProceedWithArgs) {
InstructionList ret = new InstructionList();
if (isProceedWithArgs) {
Type objectArrayType = Type.OBJECT_ARRAY;
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
int theObjectArrayLocalNumber = localAdviceMethod.allocateLocal(objectArrayType);
ret.append(InstructionFactory.createStore(objectArrayType, theObjectArrayLocalNumber));
Type proceedingJpType = Type.getType("Lorg/aspectj/lang/ProceedingJoinPoint;");
int pjpLocalNumber = localAdviceMethod.allocateLocal(proceedingJpType);
ret.append(InstructionFactory.createStore(proceedingJpType, pjpLocalNumber));
boolean pointcutBindsThis = bindsThis(munger);
boolean pointcutBindsTarget = bindsTarget(munger);
boolean targetIsSameAsThis = getKind().isTargetSameAsThis();
int nextArgumentToProvideForCallback = 0;
if (hasThis()) {
if (!(pointcutBindsTarget && targetIsSameAsThis)) {
if (pointcutBindsThis) {
ret.append(InstructionFactory.createLoad(objectArrayType, theObjectArrayLocalNumber));
ret.append(Utility.createConstant(fact, 0));
ret.append(InstructionFactory.createArrayLoad(Type.OBJECT));
ret.append(Utility.createConversion(fact, Type.OBJECT, callbackMethod.getArgumentTypes()[0]));
} else {
ret.append(InstructionFactory.createALOAD(0));
}
nextArgumentToProvideForCallback++;
}
}
if (hasTarget()) {
if (pointcutBindsTarget) {
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
if (getKind().isTargetSameAsThis()) {
ret.append(InstructionFactory.createLoad(objectArrayType, theObjectArrayLocalNumber));
ret.append(Utility.createConstant(fact, pointcutBindsThis ? 1 : 0));
ret.append(InstructionFactory.createArrayLoad(Type.OBJECT));
ret.append(Utility.createConversion(fact, Type.OBJECT, callbackMethod.getArgumentTypes()[0]));
} else {
int position = (hasThis() && pointcutBindsThis ? 1 : 0);
ret.append(InstructionFactory.createLoad(objectArrayType, theObjectArrayLocalNumber));
ret.append(Utility.createConstant(fact, position));
ret.append(InstructionFactory.createArrayLoad(Type.OBJECT));
ret.append(Utility.createConversion(fact, Type.OBJECT, callbackMethod.getArgumentTypes()[position]));
}
nextArgumentToProvideForCallback++;
} else {
if (getKind().isTargetSameAsThis()) {
} else {
ret.append(InstructionFactory.createLoad(localAdviceMethod.getArgumentTypes()[0], hasThis() ? 1 : 0));
nextArgumentToProvideForCallback++;
}
}
}
int indexIntoObjectArrayForArguments = (pointcutBindsThis ? 1 : 0) + (pointcutBindsTarget ? 1 : 0);
int len = callbackMethod.getArgumentTypes().length;
for (int i = nextArgumentToProvideForCallback; i < len; i++) {
Type stateType = callbackMethod.getArgumentTypes()[i];
BcelWorld.fromBcel(stateType).resolve(world);
if ("Lorg/aspectj/lang/JoinPoint;".equals(stateType.getSignature())) {
ret.append(new InstructionLV(Constants.ALOAD, pjpLocalNumber));
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
} else {
ret.append(InstructionFactory.createLoad(objectArrayType, theObjectArrayLocalNumber));
ret.append(Utility
.createConstant(fact, i - nextArgumentToProvideForCallback + indexIntoObjectArrayForArguments));
ret.append(InstructionFactory.createArrayLoad(Type.OBJECT));
ret.append(Utility.createConversion(fact, Type.OBJECT, stateType));
}
}
} else {
Type proceedingJpType = Type.getType("Lorg/aspectj/lang/ProceedingJoinPoint;");
int localJp = localAdviceMethod.allocateLocal(proceedingJpType);
ret.append(InstructionFactory.createStore(proceedingJpType, localJp));
for (int i = 0, len = callbackMethod.getArgumentTypes().length; i < len; i++) {
Type stateType = callbackMethod.getArgumentTypes()[i];
BcelWorld.fromBcel(stateType).resolve(world);
if ("Lorg/aspectj/lang/JoinPoint;".equals(stateType.getSignature())) {
ret.append(InstructionFactory.createALOAD(localJp));
));
} else {
ret.append(InstructionFactory.createLoad(stateType, i));
}
}
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
}
ret.append(Utility.createInvoke(fact, callbackMethod));
if (!UnresolvedType.OBJECT.equals(munger.getSignature().getReturnType())) {
ret.append(Utility.createConversion(fact, callbackMethod.getReturnType(), Type.OBJECT));
}
ret.append(Utility.createConversion(fact, callbackMethod.getReturnType(), BcelWorld.makeBcelType(munger.getSignature()
.getReturnType())));
return ret;
}
}
}
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
}
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
}
}
}
private boolean bindsThis(BcelAdvice munger) {
UsesThisVisitor utv = new UsesThisVisitor();
munger.getPointcut().accept(utv, null);
return utv.usesThis;
}
private boolean bindsTarget(BcelAdvice munger) {
UsesTargetVisitor utv = new UsesTargetVisitor();
munger.getPointcut().accept(utv, null);
return utv.usesTarget;
}
private static class UsesThisVisitor extends AbstractPatternNodeVisitor {
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
boolean usesThis = false;
public Object visit(ThisOrTargetPointcut node, Object data) {
if (node.isThis() && node.isBinding())
usesThis = true;
return node;
}
public Object visit(AndPointcut node, Object data) {
if (!usesThis)
node.getLeft().accept(this, data);
if (!usesThis)
node.getRight().accept(this, data);
return node;
}
public Object visit(NotPointcut node, Object data) {
if (!usesThis)
node.getNegatedPointcut().accept(this, data);
return node;
}
public Object visit(OrPointcut node, Object data) {
if (!usesThis)
node.getLeft().accept(this, data);
if (!usesThis)
node.getRight().accept(this, data);
return node;
}
}
private static class UsesTargetVisitor extends AbstractPatternNodeVisitor {
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
boolean usesTarget = false;
public Object visit(ThisOrTargetPointcut node, Object data) {
if (!node.isThis() && node.isBinding())
usesTarget = true;
return node;
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
}
public Object visit(AndPointcut node, Object data) {
if (!usesTarget)
node.getLeft().accept(this, data);
if (!usesTarget)
node.getRight().accept(this, data);
return node;
}
public Object visit(NotPointcut node, Object data) {
if (!usesTarget)
node.getNegatedPointcut().accept(this, data);
return node;
}
public Object visit(OrPointcut node, Object data) {
if (!usesTarget)
node.getLeft().accept(this, data);
if (!usesTarget)
node.getRight().accept(this, data);
return node;
}
}
public void weaveAroundClosure(BcelAdvice munger, boolean hasDynamicTest) {
InstructionFactory fact = getFactory();
enclosingMethod.setCanInline(false);
int linenumber = getSourceLine();
LazyMethodGen callbackMethod = extractMethod(NameMangler.aroundCallbackMethodName(getSignature(), getEnclosingClass()), 0,
munger);
BcelVar[] adviceVars = munger.getExposedStateAsBcelVars(true);
String closureClassName = NameMangler.makeClosureClassName(getEnclosingClass().getType(), getEnclosingClass()
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
.getNewGeneratedNameTag());
Member constructorSig = new MemberImpl(Member.CONSTRUCTOR, UnresolvedType.forName(closureClassName), 0, "<init>",
"([Ljava/lang/Object;)V");
BcelVar closureHolder = null;
if (getKind() == PreInitialization) {
closureHolder = genTempVar(AjcMemberMaker.AROUND_CLOSURE_TYPE);
}
InstructionList closureInstantiation = makeClosureInstantiation(constructorSig, closureHolder);
makeClosureClassAndReturnConstructor(closureClassName, callbackMethod, makeProceedArgumentMap(adviceVars));
InstructionList returnConversionCode;
if (getKind() == PreInitialization) {
returnConversionCode = new InstructionList();
BcelVar stateTempVar = genTempVar(UnresolvedType.OBJECTARRAY);
closureHolder.appendLoad(returnConversionCode, fact);
returnConversionCode.append(Utility.createInvoke(fact, world, AjcMemberMaker.aroundClosurePreInitializationGetter()));
stateTempVar.appendStore(returnConversionCode, fact);
Type[] stateTypes = getSuperConstructorParameterTypes();
returnConversionCode.append(InstructionConstants.ALOAD_0);
for (int i = 0, len = stateTypes.length; i < len; i++) {
UnresolvedType bcelTX = BcelWorld.fromBcel(stateTypes[i]);
ResolvedType stateRTX = world.resolve(bcelTX, true);
if (stateRTX.isMissing()) {
world.getLint().cantFindType.signal(new String[] { WeaverMessages.format(
WeaverMessages.CANT_FIND_TYPE_DURING_AROUND_WEAVE_PREINIT, bcelTX.getClassName()) },
getSourceLocation(), new ISourceLocation[] { munger.getSourceLocation() });
|
246,021 |
Bug 246021 FindBugs reporting another optimization
|
Ben Hale reported that FindBugs was producing a warning about a dead store to a local variable (a variable that is never then read within the method). This bug is to investigate and hopefully remove the dead store.
|
resolved fixed
|
78a483d
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2008-09-03T00:28:44Z | 2008-09-02T21:13:20Z |
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
|
}
stateTempVar.appendConvertableArrayLoad(returnConversionCode, fact, i, stateRTX);
}
} else {
Member mungerSignature = munger.getSignature();
if (munger.getSignature() instanceof ResolvedMember) {
if (((ResolvedMember) mungerSignature).hasBackingGenericMember()) {
mungerSignature = ((ResolvedMember) mungerSignature).getBackingGenericMember();
}
}
UnresolvedType returnType = mungerSignature.getReturnType();
returnConversionCode = Utility.createConversion(getFactory(), BcelWorld.makeBcelType(returnType), callbackMethod
.getReturnType(), world.isInJava5Mode());
if (!isFallsThrough()) {
returnConversionCode.append(InstructionFactory.createReturn(callbackMethod.getReturnType()));
}
}
int bitflags = 0x000000;
if (getKind().isTargetSameAsThis())
bitflags |= 0x010000;
if (hasThis())
bitflags |= 0x001000;
if (bindsThis(munger))
bitflags |= 0x000100;
if (hasTarget())
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.