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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/World.java
|
public void setOptionalJoinpoints(String jps) {
if (jps==null) return;
if (jps.indexOf("arrayconstruction")!=-1) optionalJoinpoint_ArrayConstruction = true;
if (jps.indexOf("synchronization")!=-1) optionalJoinpoint_Synchronization = true;
}
public boolean isJoinpointArrayConstructionEnabled() {
return optionalJoinpoint_ArrayConstruction;
}
public boolean isJoinpointSynchronizationEnabled() {
return optionalJoinpoint_Synchronization;
}
public String getTargetAspectjRuntimeLevel() {
return targetAspectjRuntimeLevel;
}
public boolean isTargettingAspectJRuntime12() {
boolean b = false;
if (!isInJava5Mode()) b=true;
else b = getTargetAspectjRuntimeLevel().equals(org.aspectj.weaver.Constants.RUNTIME_LEVEL_12);
return b;
}
/*
* Map of types in the world, can have 'references' to expendable ones which
* can be garbage collected to recover memory.
* An expendable type is a reference type that is not exposed to the weaver (ie
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/World.java
|
* just pulled in for type resolution purposes).
*/
protected static class TypeMap {
private static boolean debug = false;
public static int DONT_USE_REFS = 0;
public static int USE_WEAK_REFS = 1;
public static int USE_SOFT_REFS = 2;
public static int policy = USE_SOFT_REFS;
private Map tMap = new HashMap();
private Map expendableMap = new WeakHashMap();
private World w;
private boolean memoryProfiling = false;
private int maxExpendableMapSize = -1;
private int collectedTypes = 0;
private ReferenceQueue rq = new ReferenceQueue();
private static Trace trace = TraceFactory.getTraceFactory().getTrace(World.TypeMap.class);
TypeMap(World w) {
if (trace.isTraceEnabled()) trace.enter("<init>",this,w);
this.w = w;
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/World.java
|
memoryProfiling = false;
if (trace.isTraceEnabled()) trace.exit("<init>");
}
/**
* Add a new type into the map, the key is the type signature.
* Some types do *not* go in the map, these are ones involving
* *member* type variables. The reason is that when all you have is the
* signature which gives you a type variable name, you cannot
* guarantee you are using the type variable in the same way
* as someone previously working with a similarly
* named type variable. So, these do not go into the map:
* - TypeVariableReferenceType.
* - ParameterizedType where a member type variable is involved.
* - BoundedReferenceType when one of the bounds is a type variable.
*
* definition: "member type variables" - a tvar declared on a generic
* method/ctor as opposed to those you see declared on a generic type.
*/
public ResolvedType put(String key, ResolvedType type) {
if (type.isParameterizedType() && type.isParameterizedWithAMemberTypeVariable()) {
if (debug)
System.err.println("Not putting a parameterized type that utilises member declared type variables into the typemap: key="+key+" type="+type);
return type;
}
if (type.isTypeVariableReference()) {
if (debug)
System.err.println("Not putting a type variable reference type into the typemap: key="+key+" type="+type);
return type;
}
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/World.java
|
if (type instanceof BoundedReferenceType) {
if (debug)
System.err.println("Not putting a bounded reference type into the typemap: key="+key+" type="+type);
return type;
}
if (type instanceof MissingResolvedTypeWithKnownSignature) {
if (debug)
System.err.println("Not putting a missing type into the typemap: key="+key+" type="+type);
return type;
}
if ((type instanceof ReferenceType) && (((ReferenceType)type).getDelegate()==null) && w.isExpendable(type)) {
if (debug)
System.err.println("Not putting expendable ref type with null delegate into typemap: key="+key+" type="+type);
return type;
}
if (w.isExpendable(type)) {
if (policy==USE_WEAK_REFS) {
if (memoryProfiling) expendableMap.put(key,new WeakReference(type,rq));
else expendableMap.put(key,new WeakReference(type));
} else if (policy==USE_SOFT_REFS) {
if (memoryProfiling) expendableMap.put(key,new SoftReference(type,rq));
else expendableMap.put(key,new SoftReference(type));
} else {
expendableMap.put(key,type);
}
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/World.java
|
if (memoryProfiling && expendableMap.size()>maxExpendableMapSize) {
maxExpendableMapSize = expendableMap.size();
}
return type;
} else {
return (ResolvedType) tMap.put(key,type);
}
}
public void report() {
if (!memoryProfiling) return;
checkq();
w.getMessageHandler().handleMessage(MessageUtil.info("MEMORY: world expendable type map reached maximum size of #"+maxExpendableMapSize+" entries"));
w.getMessageHandler().handleMessage(MessageUtil.info("MEMORY: types collected through garbage collection #"+collectedTypes+" entries"));
}
public void checkq() {
if (!memoryProfiling) return;
while (rq.poll()!=null) collectedTypes++;
}
/**
* Lookup a type by its signature, always look
* in the real map before the expendable map
*/
public ResolvedType get(String key) {
checkq();
ResolvedType ret = (ResolvedType) tMap.get(key);
if (ret == null) {
if (policy==USE_WEAK_REFS) {
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/World.java
|
WeakReference ref = (WeakReference)expendableMap.get(key);
if (ref != null) {
ret = (ResolvedType) ref.get();
}
} else if (policy==USE_SOFT_REFS) {
SoftReference ref = (SoftReference)expendableMap.get(key);
if (ref != null) {
ret = (ResolvedType) ref.get();
}
} else {
return (ResolvedType)expendableMap.get(key);
}
}
return ret;
}
public ResolvedType remove(String key) {
ResolvedType ret = (ResolvedType) tMap.remove(key);
if (ret == null) {
if (policy==USE_WEAK_REFS) {
WeakReference wref = (WeakReference)expendableMap.remove(key);
if (wref!=null) ret = (ResolvedType)wref.get();
} else if (policy==USE_SOFT_REFS) {
SoftReference wref = (SoftReference)expendableMap.remove(key);
if (wref!=null) ret = (ResolvedType)wref.get();
} else {
ret = (ResolvedType)expendableMap.remove(key);
}
}
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/World.java
|
return ret;
}
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("types:\n");
sb.append(dumpthem(tMap));
sb.append("expendables:\n");
sb.append(dumpthem(expendableMap));
return sb.toString();
}
private String dumpthem(Map m) {
StringBuffer sb = new StringBuffer();
int otherTypes = 0;
int bcelDel = 0;
int refDel = 0;
for (Iterator iter = m.entrySet().iterator(); iter.hasNext();) {
Map.Entry entry = (Map.Entry) iter.next();
Object val = entry.getValue();
if (val instanceof WeakReference) {
val = ((WeakReference)val).get();
} else
if (val instanceof SoftReference) {
val = ((SoftReference)val).get();
}
sb.append(entry.getKey()+"="+val).append("\n");
if (val instanceof ReferenceType) {
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/World.java
|
ReferenceType refType = (ReferenceType)val;
if (refType.getDelegate() instanceof BcelObjectType) {
bcelDel++;
} else if (refType.getDelegate() instanceof ReflectionBasedReferenceTypeDelegate) {
refDel++;
} else {
otherTypes++;
}
} else {
otherTypes++;
}
}
sb.append("# BCEL = "+bcelDel+", # REF = "+refDel+", # Other = "+otherTypes);
return sb.toString();
}
public int totalSize() {
return tMap.size()+expendableMap.size();
}
public int hardSize() {
return tMap.size();
}
}
/** Reference types we don't intend to weave may be ejected from
* the cache if we need the space.
*/
protected boolean isExpendable(ResolvedType type) {
return (
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/World.java
|
!type.equals(UnresolvedType.OBJECT) &&
(type != null) &&
(!type.isExposedToWeaver()) &&
(!type.isPrimitiveType())
);
}
/**
* This class is used to compute and store precedence relationships between
* aspects.
*/
private static class AspectPrecedenceCalculator {
private World world;
private Map cachedResults;
public AspectPrecedenceCalculator(World forSomeWorld) {
this.world = forSomeWorld;
this.cachedResults = new HashMap();
}
/**
* Ask every declare precedence in the world to order the two aspects.
* If more than one declare precedence gives an ordering, and the orderings
* conflict, then that's an error.
*/
public int compareByPrecedence(ResolvedType firstAspect, ResolvedType secondAspect) {
PrecedenceCacheKey key = new PrecedenceCacheKey(firstAspect,secondAspect);
if (cachedResults.containsKey(key)) {
return ((Integer) cachedResults.get(key)).intValue();
} else {
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/World.java
|
int order = 0;
DeclarePrecedence orderer = null;
for (Iterator i = world.getCrosscuttingMembersSet().getDeclareDominates().iterator(); i.hasNext(); ) {
DeclarePrecedence d = (DeclarePrecedence)i.next();
int thisOrder = d.compare(firstAspect, secondAspect);
if (thisOrder != 0) {
if (orderer==null) orderer = d;
if (order != 0 && order != thisOrder) {
ISourceLocation[] isls = new ISourceLocation[2];
isls[0]=orderer.getSourceLocation();
isls[1]=d.getSourceLocation();
Message m =
new Message("conflicting declare precedence orderings for aspects: "+
firstAspect.getName()+" and "+secondAspect.getName(),null,true,isls);
world.getMessageHandler().handleMessage(m);
} else {
order = thisOrder;
}
}
}
cachedResults.put(key, new Integer(order));
return order;
}
}
public Integer getPrecedenceIfAny(ResolvedType aspect1,ResolvedType aspect2) {
return (Integer)cachedResults.get(new PrecedenceCacheKey(aspect1,aspect2));
}
public int compareByPrecedenceAndHierarchy(ResolvedType firstAspect, ResolvedType secondAspect) {
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/World.java
|
if (firstAspect.equals(secondAspect)) return 0;
int ret = compareByPrecedence(firstAspect, secondAspect);
if (ret != 0) return ret;
if (firstAspect.isAssignableFrom(secondAspect)) return -1;
else if (secondAspect.isAssignableFrom(firstAspect)) return +1;
return 0;
}
private static class PrecedenceCacheKey {
public ResolvedType aspect1;
public ResolvedType aspect2;
public PrecedenceCacheKey(ResolvedType a1, ResolvedType a2) {
this.aspect1 = a1;
this.aspect2 = a2;
}
public boolean equals(Object obj) {
if (!(obj instanceof PrecedenceCacheKey)) return false;
PrecedenceCacheKey other = (PrecedenceCacheKey) obj;
return (aspect1 == other.aspect1 && aspect2 == other.aspect2);
}
public int hashCode() {
return aspect1.hashCode() + aspect2.hashCode();
}
}
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/World.java
|
}
public void validateType(UnresolvedType type) { }
private Map workInProgress1 = new HashMap();
public TypeVariable[] getTypeVariablesCurrentlyBeingProcessed(Class baseClass) {
return (TypeVariable[])workInProgress1.get(baseClass);
}
public void recordTypeVariablesCurrentlyBeingProcessed(Class baseClass, TypeVariable[] typeVariables) {
workInProgress1.put(baseClass,typeVariables);
}
public void forgetTypeVariablesCurrentlyBeingProcessed(Class baseClass) {
workInProgress1.remove(baseClass);
}
public void setAddSerialVerUID(boolean b) { addSerialVerUID=b;}
public boolean isAddSerialVerUID() { return addSerialVerUID;}
public void flush() {
typeMap.expendableMap.clear();
}
public void ensureAdvancedConfigurationProcessed() {
if (!checkedAdvancedConfiguration) {
Properties p = getExtraConfiguration();
if (p!=null) {
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/World.java
|
if (isASMAround) {
String s = p.getProperty(xsetACTIVATE_LIGHTWEIGHT_DELEGATES,"true");
fastDelegateSupportEnabled = s.equalsIgnoreCase("true");
if (!fastDelegateSupportEnabled)
getMessageHandler().handleMessage(MessageUtil.info("[activateLightweightDelegates=false] Disabling optimization to use lightweight delegates for non-woven types"));
}
String s = p.getProperty(xsetPIPELINE_COMPILATION,xsetPIPELINE_COMPILATION_DEFAULT);
shouldPipelineCompilation = s.equalsIgnoreCase("true");
s = p.getProperty(xsetRUN_MINIMAL_MEMORY,"false");
runMinimalMemory = s.equalsIgnoreCase("true");
s = p.getProperty(xsetDEBUG_STRUCTURAL_CHANGES_CODE,"false");
forDEBUG_structuralChangesCode = s.equalsIgnoreCase("true");
s = p.getProperty(xsetDEBUG_BRIDGING,"false");
forDEBUG_bridgingCode = s.equalsIgnoreCase("true");
}
checkedAdvancedConfiguration=true;
}
}
public boolean isRunMinimalMemory() {
ensureAdvancedConfigurationProcessed();
return runMinimalMemory;
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/World.java
|
}
public boolean shouldPipelineCompilation() {
ensureAdvancedConfigurationProcessed();
return shouldPipelineCompilation;
}
public void setFastDelegateSupport(boolean b) {
if (b && !isASMAround) {
throw new BCException("Unable to activate fast delegate support, ASM classes cannot be found");
}
fastDelegateSupportEnabled = b;
}
public boolean isFastDelegateSupportEnabled() {
ensureAdvancedConfigurationProcessed();
return fastDelegateSupportEnabled;
}
public void setIncrementalCompileCouldFollow(boolean b) {incrementalCompileCouldFollow = b;}
public boolean couldIncrementalCompileFollow() {return incrementalCompileCouldFollow;}
public void setSynchronizationPointcutsInUse() {
if (trace.isTraceEnabled()) trace.enter("setSynchronizationPointcutsInUse", this);
synchronizationPointcutsInUse =true;
if (trace.isTraceEnabled()) trace.exit("setSynchronizationPointcutsInUse");
}
public boolean areSynchronizationPointcutsInUse() {return synchronizationPointcutsInUse;}
}
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
|
/* *******************************************************************
* Copyright (c) 2004 IBM Corporation
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
* which accompanies this distribution and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Matthew Webster, Adrian Colyer,
* Martin Lippert initial implementation
* ******************************************************************/
package org.aspectj.weaver.tools;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
|
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
import org.aspectj.bridge.AbortException;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.IMessageHandler;
import org.aspectj.bridge.Message;
import org.aspectj.bridge.MessageUtil;
import org.aspectj.bridge.MessageWriter;
import org.aspectj.bridge.Version;
import org.aspectj.bridge.IMessage.Kind;
import org.aspectj.util.FileUtil;
import org.aspectj.util.LangUtil;
import org.aspectj.weaver.IClassFileProvider;
import org.aspectj.weaver.IWeaveRequestor;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.bcel.BcelObjectType;
import org.aspectj.weaver.bcel.BcelWeaver;
import org.aspectj.weaver.bcel.BcelWorld;
import org.aspectj.weaver.bcel.UnwovenClassFile;
import org.aspectj.weaver.bcel.Utility;
/**
* This adaptor allows the AspectJ compiler to be embedded in an existing
* system to facilitate load-time weaving. It provides an interface for a
* weaving class loader to provide a classpath to be woven by a set of
* aspects. A callback is supplied to allow a class loader to define classes
* generated by the compiler during the weaving process.
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
|
* <p>
* A weaving class loader should create a <code>WeavingAdaptor</code> before
* any classes are defined, typically during construction. The set of aspects
* passed to the adaptor is fixed for the lifetime of the adaptor although the
* classpath can be augmented. A system property can be set to allow verbose
* weaving messages to be written to the console.
*
*/
public class WeavingAdaptor {
/**
* System property used to turn on verbose weaving messages
*/
public static final String WEAVING_ADAPTOR_VERBOSE = "aj.weaving.verbose";
public static final String SHOW_WEAVE_INFO_PROPERTY = "org.aspectj.weaver.showWeaveInfo";
protected boolean enabled = true;
protected boolean verbose = getVerbose();
protected BcelWorld bcelWorld;
protected BcelWeaver weaver;
private IMessageHandler messageHandler;
private WeavingAdaptorMessageHandler messageHolder;
protected GeneratedClassHandler generatedClassHandler;
protected Map generatedClasses = new HashMap();
protected BcelObjectType delegateForCurrentClass;
private static Trace trace = TraceFactory.getTraceFactory().getTrace(WeavingAdaptor.class);
protected WeavingAdaptor () {
}
/**
* Construct a WeavingAdaptor with a reference to a weaving class loader. The
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
|
* adaptor will automatically search the class loader hierarchy to resolve
* classes. The adaptor will also search the hierarchy for WeavingClassLoader
* instances to determine the set of aspects to be used ofr weaving.
* @param loader instance of <code>ClassLoader</code>
*/
public WeavingAdaptor (WeavingClassLoader loader) {
generatedClassHandler = loader;
init(getFullClassPath((ClassLoader)loader),getFullAspectPath((ClassLoader)loader));
}
/**
* Construct a WeavingAdator with a reference to a
* <code>GeneratedClassHandler</code>, a full search path for resolving
* classes and a complete set of aspects. The search path must include
* classes loaded by the class loader constructing the WeavingAdaptor and
* all its parents in the hierarchy.
* @param handler <code>GeneratedClassHandler</code>
* @param classURLs the URLs from which to resolve classes
* @param aspectURLs the aspects used to weave classes defined by this class loader
*/
public WeavingAdaptor (GeneratedClassHandler handler, URL[] classURLs, URL[] aspectURLs) {
generatedClassHandler = handler;
init(FileUtil.makeClasspath(classURLs),FileUtil.makeClasspath(aspectURLs));
}
private List getFullClassPath (ClassLoader loader) {
List list = new LinkedList();
for (; loader != null; loader = loader.getParent()) {
if (loader instanceof URLClassLoader) {
URL[] urls = ((URLClassLoader)loader).getURLs();
list.addAll(0,FileUtil.makeClasspath(urls));
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
|
}
else {
warn("cannot determine classpath");
}
}
list.addAll(0,makeClasspath(System.getProperty("sun.boot.class.path")));
return list;
}
private List getFullAspectPath (ClassLoader loader) {
List list = new LinkedList();
for (; loader != null; loader = loader.getParent()) {
if (loader instanceof WeavingClassLoader) {
URL[] urls = ((WeavingClassLoader)loader).getAspectURLs();
list.addAll(0,FileUtil.makeClasspath(urls));
}
}
return list;
}
private static boolean getVerbose () {
return Boolean.getBoolean(WEAVING_ADAPTOR_VERBOSE);
}
private void init(List classPath, List aspectPath) {
createMessageHandler();
info("using classpath: " + classPath);
info("using aspectpath: " + aspectPath);
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
|
bcelWorld = new BcelWorld(classPath,messageHandler,null);
bcelWorld.setXnoInline(false);
bcelWorld.getLint().loadDefaultProperties();
if (LangUtil.is15VMOrGreater()) {
bcelWorld.setBehaveInJava5Way(true);
}
weaver = new BcelWeaver(bcelWorld);
registerAspectLibraries(aspectPath);
}
protected void createMessageHandler() {
messageHolder = new WeavingAdaptorMessageHandler(new PrintWriter(System.err));
messageHandler = messageHolder;
if (verbose) messageHandler.dontIgnore(IMessage.INFO);
if (Boolean.getBoolean(SHOW_WEAVE_INFO_PROPERTY)) messageHandler.dontIgnore(IMessage.WEAVEINFO);
info("AspectJ Weaver Version " + Version.text + " built on " + Version.time_text);
}
protected IMessageHandler getMessageHandler () {
return messageHandler;
}
protected void setMessageHandler (IMessageHandler mh) {
if (messageHolder != null) {
messageHolder.flushMessages();
messageHolder = null;
}
messageHandler = mh;
bcelWorld.setMessageHandler(mh);
}
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
|
/**
* Appends URL to path used by the WeavingAdptor to resolve classes
* @param url to be appended to search path
*/
public void addURL(URL url) {
File libFile = new File(url.getPath());
try {
weaver.addLibraryJarFile(libFile);
}
catch (IOException ex) {
warn("bad library: '" + libFile + "'");
}
}
/**
* Weave a class using aspects previously supplied to the adaptor.
* @param name the name of the class
* @param bytes the class bytes
* @return the woven bytes
* @exception IOException weave failed
*/
public byte[] weaveClass (String name, byte[] bytes) throws IOException {
if (enabled) {
try {
delegateForCurrentClass=null;
if (trace.isTraceEnabled()) trace.enter("weaveClass",this,new Object[] {name,bytes});
if (shouldWeave(name, bytes)) {
info("weaving '" + name + "'");
bytes = getWovenBytes(name, bytes);
} else if (shouldWeaveAnnotationStyleAspect(name, bytes)) {
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
|
info("weaving '" + name + "'");
bytes = getAtAspectJAspectBytes(name, bytes);
}
else {
info("not weaving '" + name + "'");
}
if (trace.isTraceEnabled()) trace.exit("weaveClass",bytes);
} finally {
delegateForCurrentClass=null;
}
}
return bytes;
}
/**
* @param name
* @return true if should weave (but maybe we still need to munge it for @AspectJ aspectof support)
*/
private boolean shouldWeave (String name, byte[] bytes) {
name = name.replace('/','.');
boolean b = !generatedClasses.containsKey(name) && shouldWeaveName(name);
return b && accept(name, bytes);
}
protected boolean accept(String name, byte[] bytes) {
return true;
}
protected boolean shouldDump(String name, boolean before) {
return false;
}
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
|
private boolean shouldWeaveName (String name) {
boolean should =
!((name.startsWith("org.aspectj.")
|| name.startsWith("java.")
|| name.startsWith("javax."))
|| name.startsWith("sun.reflect."));
return should;
}
/**
* We allow @AJ aspect weaving so that we can add aspectOf() as part of the weaving
* (and not part of the source compilation)
*
* @param name
* @param bytes bytecode (from classloader), allow to NOT lookup stuff on disk again during resolve
* @return true if @Aspect
*/
private boolean shouldWeaveAnnotationStyleAspect(String name, byte[] bytes) {
ensureDelegateInitialized(name,bytes);
return (delegateForCurrentClass.isAnnotationStyleAspect());
}
protected void ensureDelegateInitialized(String name,byte[] bytes) {
if (delegateForCurrentClass==null)
delegateForCurrentClass = ((BcelWorld)weaver.getWorld()).addSourceObjectType(Utility.makeJavaClass(name, bytes));
}
/**
* Weave a set of bytes defining a class.
* @param name the name of the class being woven
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
|
* @param bytes the bytes that define the class
* @return byte[] the woven bytes for the class
* @throws IOException
*/
private byte[] getWovenBytes(String name, byte[] bytes) throws IOException {
WeavingClassFileProvider wcp = new WeavingClassFileProvider(name,bytes);
weaver.weave(wcp);
return wcp.getBytes();
}
/**
* Weave a set of bytes defining a class for only what is needed to turn @AspectJ aspect
* in a usefull form ie with aspectOf method - see #113587
* @param name the name of the class being woven
* @param bytes the bytes that define the class
* @return byte[] the woven bytes for the class
* @throws IOException
*/
private byte[] getAtAspectJAspectBytes(String name, byte[] bytes) throws IOException {
WeavingClassFileProvider wcp = new WeavingClassFileProvider(name,bytes);
wcp.setApplyAtAspectJMungersOnly();
weaver.weave(wcp);
return wcp.getBytes();
}
private void registerAspectLibraries(List aspectPath) {
for (Iterator i = aspectPath.iterator(); i.hasNext();) {
String libName = (String)i.next();
addAspectLibrary(libName);
}
weaver.prepareForWeave();
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
|
}
/*
* Register an aspect library with this classloader for use during
* weaving. This class loader will also return (unmodified) any of the
* classes in the library in response to a <code>findClass()</code> request.
* The library is not required to be on the weavingClasspath given when this
* classloader was constructed.
* @param aspectLibraryJarFile a jar file representing an aspect library
* @throws IOException
*/
private void addAspectLibrary(String aspectLibraryName) {
File aspectLibrary = new File(aspectLibraryName);
if (aspectLibrary.isDirectory()
|| (FileUtil.isZipFile(aspectLibrary))) {
try {
info("adding aspect library: '" + aspectLibrary + "'");
weaver.addLibraryJarFile(aspectLibrary);
} catch (IOException ex) {
error("exception adding aspect library: '" + ex + "'");
}
} else {
error("bad aspect library: '" + aspectLibrary + "'");
}
}
private static List makeClasspath(String cp) {
List ret = new ArrayList();
if (cp != null) {
StringTokenizer tok = new StringTokenizer(cp,File.pathSeparator);
while (tok.hasMoreTokens()) {
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
|
ret.add(tok.nextToken());
}
}
return ret;
}
protected boolean info (String message) {
return MessageUtil.info(messageHandler,message);
}
protected boolean warn (String message) {
return MessageUtil.warn(messageHandler,message);
}
protected boolean warn (String message, Throwable th) {
return messageHandler.handleMessage(new Message(message, IMessage.WARNING, th, null));
}
protected boolean error (String message) {
return MessageUtil.error(messageHandler,message);
}
protected String getContextId () {
return "WeavingAdaptor";
}
/**
* Dump the given bytcode in _dump/... (dev mode)
*
* @param name
* @param b
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
|
* @param before whether we are dumping before weaving
* @throws Throwable
*/
protected void dump(String name, byte[] b, boolean before) {
String dirName = "_ajdump";
if (before) dirName = dirName + File.separator + "_before";
String className = name.replace('.', '/');
final File dir;
if (className.indexOf('/') > 0) {
dir = new File(dirName + File.separator + className.substring(0, className.lastIndexOf('/')));
} else {
dir = new File(dirName);
}
dir.mkdirs();
String fileName = dirName + File.separator + className + ".class";
try {
FileOutputStream os = new FileOutputStream(fileName);
os.write(b);
os.close();
}
catch (IOException ex) {
warn("unable to dump class " + name + " in directory " + dirName,ex);
}
}
/**
* Processes messages arising from weaver operations.
* Tell weaver to abort on any message more severe than warning.
*/
protected class WeavingAdaptorMessageHandler extends MessageWriter {
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
|
private Set ignoring = new HashSet();
private IMessage.Kind failKind;
private boolean accumulating = true;
private List messages = new ArrayList();
public WeavingAdaptorMessageHandler (PrintWriter writer) {
super(writer,true);
ignore(IMessage.WEAVEINFO);
ignore(IMessage.INFO);
this.failKind = IMessage.ERROR;
}
public boolean handleMessage(IMessage message) throws AbortException {
addMessage(message);
boolean result = super.handleMessage(message);
if (0 <= message.getKind().compareTo(failKind)) {
throw new AbortException(message);
}
return true;
}
public boolean isIgnoring (Kind kind) {
return ((null != kind) && (ignoring.contains(kind)));
}
/**
* Set a message kind to be ignored from now on
*/
public void ignore (IMessage.Kind kind) {
if ((null != kind) && (!ignoring.contains(kind))) {
ignoring.add(kind);
}
}
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
|
/**
* Remove a message kind from the list of those ignored from now on.
*/
public void dontIgnore (IMessage.Kind kind) {
if (null != kind) {
ignoring.remove(kind);
if (kind.equals(IMessage.INFO)) accumulating = false;
}
}
private void addMessage (IMessage message) {
if (accumulating && isIgnoring(message.getKind())) {
messages.add(message);
}
}
public void flushMessages () {
for (Iterator iter = messages.iterator(); iter.hasNext();) {
IMessage message = (IMessage)iter.next();
super.handleMessage(message);
}
accumulating = false;
messages.clear();
}
protected String render(IMessage message) {
return "[" + getContextId() + "] " + super.render(message);
}
}
private class WeavingClassFileProvider implements IClassFileProvider {
private UnwovenClassFile unwovenClass;
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
|
private List unwovenClasses = new ArrayList();
private UnwovenClassFile wovenClass;
private boolean isApplyAtAspectJMungersOnly = false;
public WeavingClassFileProvider (String name, byte[] bytes) {
ensureDelegateInitialized(name, bytes);
this.unwovenClass = new UnwovenClassFile(name,delegateForCurrentClass.getResolvedTypeX().getName(),bytes);
this.unwovenClasses.add(unwovenClass);
if (shouldDump(name.replace('/', '.'),true)) {
dump(name, bytes, true);
}
}
public void setApplyAtAspectJMungersOnly() {
isApplyAtAspectJMungersOnly = true;
}
public boolean isApplyAtAspectJMungersOnly() {
return isApplyAtAspectJMungersOnly;
}
public byte[] getBytes () {
if (wovenClass != null) return wovenClass.getBytes();
else return unwovenClass.getBytes();
}
public Iterator getClassFileIterator() {
return unwovenClasses.iterator();
}
public IWeaveRequestor getRequestor() {
return new IWeaveRequestor() {
public void acceptResult(UnwovenClassFile result) {
if (wovenClass == null) {
|
152,873 |
Bug 152873 Optimize shouldWeaveAnnotationStyleAspect with Patch
| null |
resolved fixed
|
f239f2a
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T07:59:54Z | 2006-08-04T19:33:20Z |
weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
|
wovenClass = result;
String name = result.getClassName();
if (shouldDump(name.replace('/', '.'), false)) {
dump(name, result.getBytes(), false);
}
}
else {
String className = result.getClassName();
generatedClasses.put(className,result);
generatedClasses.put(wovenClass.getClassName(),result);
generatedClassHandler.acceptClass(className,result.getBytes());
}
}
public void processingReweavableState() { }
public void addingTypeMungers() {}
public void weavingAspects() {}
public void weavingClasses() {}
public void weaveCompleted() {
ResolvedType.resetPrimitives();
if (delegateForCurrentClass!=null) delegateForCurrentClass.weavingCompleted();
ResolvedType.resetPrimitives();
}
};
}
}
}
|
152,979 |
Bug 152979 Optimization: Reference Use and URL Caching in ClassLoader Repository
|
I have found that a lot of memory can get pinned by the BCEL ClassLoaderRepository. For example, on a test configuration of Glassbox with WebLogic over 40 megabytes were pinned in memory due to this loader. (*) I also notice that some of the time spent with loading and parsing redundant classes for shared weaving configuration could be reduced by having a global cache of bytes for URL's instead, i.e., the ClassLoaderRepository is local to a loader, so even if the same class on disk is resolved multiple times in different loaders, it isn't read from cache. This latter issue will be reduced if loading types from a parent loader use reflection delegates instead but BCEL still has to be used for aspects on <1.5 VM's... The attached patch has some metrics in it to measure what's happening and it also uses SoftReferences to cache without pinning the reference types and uses a two-step look up process to maintain a global URL cache. When I run this on WebLogic 9.2 with Glassbox and view their admin console and some smaller apps I get this output: BCEL repository total load time: 7733 ms, in url: 6029 ms for 1427 url cache hits = 1683 missEvicted = 0 missUrlEvicted= 0 all misses = 1427, loader hits = 0 On Tomcat 5.5 with some different sample apps: BCEL repository total load time: 4945 ms, in url: 4319 ms for 636 url cache hits = 548 missEvicted = 0 missUrlEvicted= 190 all misses= 446, loader hits = 3 So at least in my configuration the URL-based cache is quite effective (with almost a 50% hit rate) whereas the loader-based cache provides little value. From what I've seen, it's worth considering not even using the loader-based BCEL cache at all but others may have configurations where it helps. (*) This test was on a development build of AspectJ which I had modified so that the LTWWorld evicts classes after loading
|
resolved fixed
|
387c3ac
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T11:26:28Z | 2006-08-07T14:13:20Z |
bcel-builder/src/org/aspectj/apache/bcel/util/ClassLoaderRepository.java
|
package org.aspectj.apache.bcel.util;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
|
152,979 |
Bug 152979 Optimization: Reference Use and URL Caching in ClassLoader Repository
|
I have found that a lot of memory can get pinned by the BCEL ClassLoaderRepository. For example, on a test configuration of Glassbox with WebLogic over 40 megabytes were pinned in memory due to this loader. (*) I also notice that some of the time spent with loading and parsing redundant classes for shared weaving configuration could be reduced by having a global cache of bytes for URL's instead, i.e., the ClassLoaderRepository is local to a loader, so even if the same class on disk is resolved multiple times in different loaders, it isn't read from cache. This latter issue will be reduced if loading types from a parent loader use reflection delegates instead but BCEL still has to be used for aspects on <1.5 VM's... The attached patch has some metrics in it to measure what's happening and it also uses SoftReferences to cache without pinning the reference types and uses a two-step look up process to maintain a global URL cache. When I run this on WebLogic 9.2 with Glassbox and view their admin console and some smaller apps I get this output: BCEL repository total load time: 7733 ms, in url: 6029 ms for 1427 url cache hits = 1683 missEvicted = 0 missUrlEvicted= 0 all misses = 1427, loader hits = 0 On Tomcat 5.5 with some different sample apps: BCEL repository total load time: 4945 ms, in url: 4319 ms for 636 url cache hits = 548 missEvicted = 0 missUrlEvicted= 190 all misses= 446, loader hits = 3 So at least in my configuration the URL-based cache is quite effective (with almost a 50% hit rate) whereas the loader-based cache provides little value. From what I've seen, it's worth considering not even using the loader-based BCEL cache at all but others may have configurations where it helps. (*) This test was on a development build of AspectJ which I had modified so that the LTWWorld evicts classes after loading
|
resolved fixed
|
387c3ac
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T11:26:28Z | 2006-08-07T14:13:20Z |
bcel-builder/src/org/aspectj/apache/bcel/util/ClassLoaderRepository.java
|
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache BCEL" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [email protected].
*
* 5. Products derived from this software may not be called "Apache",
* "Apache BCEL", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
|
152,979 |
Bug 152979 Optimization: Reference Use and URL Caching in ClassLoader Repository
|
I have found that a lot of memory can get pinned by the BCEL ClassLoaderRepository. For example, on a test configuration of Glassbox with WebLogic over 40 megabytes were pinned in memory due to this loader. (*) I also notice that some of the time spent with loading and parsing redundant classes for shared weaving configuration could be reduced by having a global cache of bytes for URL's instead, i.e., the ClassLoaderRepository is local to a loader, so even if the same class on disk is resolved multiple times in different loaders, it isn't read from cache. This latter issue will be reduced if loading types from a parent loader use reflection delegates instead but BCEL still has to be used for aspects on <1.5 VM's... The attached patch has some metrics in it to measure what's happening and it also uses SoftReferences to cache without pinning the reference types and uses a two-step look up process to maintain a global URL cache. When I run this on WebLogic 9.2 with Glassbox and view their admin console and some smaller apps I get this output: BCEL repository total load time: 7733 ms, in url: 6029 ms for 1427 url cache hits = 1683 missEvicted = 0 missUrlEvicted= 0 all misses = 1427, loader hits = 0 On Tomcat 5.5 with some different sample apps: BCEL repository total load time: 4945 ms, in url: 4319 ms for 636 url cache hits = 548 missEvicted = 0 missUrlEvicted= 190 all misses= 446, loader hits = 3 So at least in my configuration the URL-based cache is quite effective (with almost a 50% hit rate) whereas the loader-based cache provides little value. From what I've seen, it's worth considering not even using the loader-based BCEL cache at all but others may have configurations where it helps. (*) This test was on a development build of AspectJ which I had modified so that the LTWWorld evicts classes after loading
|
resolved fixed
|
387c3ac
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T11:26:28Z | 2006-08-07T14:13:20Z |
bcel-builder/src/org/aspectj/apache/bcel/util/ClassLoaderRepository.java
|
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import java.io.IOException;
import java.io.InputStream;
import java.util.WeakHashMap;
import org.aspectj.apache.bcel.classfile.ClassParser;
import org.aspectj.apache.bcel.classfile.JavaClass;
/**
* The repository maintains information about which classes have
* been loaded.
*
* It loads its data from the ClassLoader implementation
* passed into its constructor.
*
* @see org.aspectj.apache.bcel.Repository
*
* @version $Id: ClassLoaderRepository.java,v 1.5 2006/03/10 13:29:05 aclement Exp $
* @author <A HREF="mailto:[email protected]">M. Dahm</A>
* @author David Dixon-Peugh
*/
public class ClassLoaderRepository
implements Repository
{
private java.lang.ClassLoader loader;
private WeakHashMap loadedClasses =
new WeakHashMap();
public ClassLoaderRepository( java.lang.ClassLoader loader ) {
this.loader = loader;
|
152,979 |
Bug 152979 Optimization: Reference Use and URL Caching in ClassLoader Repository
|
I have found that a lot of memory can get pinned by the BCEL ClassLoaderRepository. For example, on a test configuration of Glassbox with WebLogic over 40 megabytes were pinned in memory due to this loader. (*) I also notice that some of the time spent with loading and parsing redundant classes for shared weaving configuration could be reduced by having a global cache of bytes for URL's instead, i.e., the ClassLoaderRepository is local to a loader, so even if the same class on disk is resolved multiple times in different loaders, it isn't read from cache. This latter issue will be reduced if loading types from a parent loader use reflection delegates instead but BCEL still has to be used for aspects on <1.5 VM's... The attached patch has some metrics in it to measure what's happening and it also uses SoftReferences to cache without pinning the reference types and uses a two-step look up process to maintain a global URL cache. When I run this on WebLogic 9.2 with Glassbox and view their admin console and some smaller apps I get this output: BCEL repository total load time: 7733 ms, in url: 6029 ms for 1427 url cache hits = 1683 missEvicted = 0 missUrlEvicted= 0 all misses = 1427, loader hits = 0 On Tomcat 5.5 with some different sample apps: BCEL repository total load time: 4945 ms, in url: 4319 ms for 636 url cache hits = 548 missEvicted = 0 missUrlEvicted= 190 all misses= 446, loader hits = 3 So at least in my configuration the URL-based cache is quite effective (with almost a 50% hit rate) whereas the loader-based cache provides little value. From what I've seen, it's worth considering not even using the loader-based BCEL cache at all but others may have configurations where it helps. (*) This test was on a development build of AspectJ which I had modified so that the LTWWorld evicts classes after loading
|
resolved fixed
|
387c3ac
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T11:26:28Z | 2006-08-07T14:13:20Z |
bcel-builder/src/org/aspectj/apache/bcel/util/ClassLoaderRepository.java
|
}
/**
* Store a new JavaClass into this Repository.
*/
public void storeClass( JavaClass clazz ) {
loadedClasses.put( clazz.getClassName(),
clazz );
clazz.setRepository( this );
}
/**
* Remove class from repository
*/
public void removeClass(JavaClass clazz) {
loadedClasses.remove(clazz.getClassName());
}
/**
* Find an already defined JavaClass.
*/
public JavaClass findClass( String className ) {
if ( loadedClasses.containsKey( className )) {
return (JavaClass) loadedClasses.get( className );
} else {
return null;
}
}
/**
* Lookup a JavaClass object from the Class Name provided.
*/
public JavaClass loadClass( String className )
throws ClassNotFoundException
|
152,979 |
Bug 152979 Optimization: Reference Use and URL Caching in ClassLoader Repository
|
I have found that a lot of memory can get pinned by the BCEL ClassLoaderRepository. For example, on a test configuration of Glassbox with WebLogic over 40 megabytes were pinned in memory due to this loader. (*) I also notice that some of the time spent with loading and parsing redundant classes for shared weaving configuration could be reduced by having a global cache of bytes for URL's instead, i.e., the ClassLoaderRepository is local to a loader, so even if the same class on disk is resolved multiple times in different loaders, it isn't read from cache. This latter issue will be reduced if loading types from a parent loader use reflection delegates instead but BCEL still has to be used for aspects on <1.5 VM's... The attached patch has some metrics in it to measure what's happening and it also uses SoftReferences to cache without pinning the reference types and uses a two-step look up process to maintain a global URL cache. When I run this on WebLogic 9.2 with Glassbox and view their admin console and some smaller apps I get this output: BCEL repository total load time: 7733 ms, in url: 6029 ms for 1427 url cache hits = 1683 missEvicted = 0 missUrlEvicted= 0 all misses = 1427, loader hits = 0 On Tomcat 5.5 with some different sample apps: BCEL repository total load time: 4945 ms, in url: 4319 ms for 636 url cache hits = 548 missEvicted = 0 missUrlEvicted= 190 all misses= 446, loader hits = 3 So at least in my configuration the URL-based cache is quite effective (with almost a 50% hit rate) whereas the loader-based cache provides little value. From what I've seen, it's worth considering not even using the loader-based BCEL cache at all but others may have configurations where it helps. (*) This test was on a development build of AspectJ which I had modified so that the LTWWorld evicts classes after loading
|
resolved fixed
|
387c3ac
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T11:26:28Z | 2006-08-07T14:13:20Z |
bcel-builder/src/org/aspectj/apache/bcel/util/ClassLoaderRepository.java
|
{
String classFile = className.replace('.', '/');
JavaClass RC = findClass( className );
if (RC != null) { return RC; }
try {
InputStream is =
loader.getResourceAsStream( classFile + ".class" );
if(is == null) {
throw new ClassNotFoundException(className + " not found.");
}
ClassParser parser = new ClassParser( is, className );
RC = parser.parse();
storeClass( RC );
return RC;
} catch (IOException e) {
throw new ClassNotFoundException( e.toString() );
}
}
public JavaClass loadClass(Class clazz) throws ClassNotFoundException {
return loadClass(clazz.getName());
}
/** Clear all entries from cache.
*/
public void clear() {
loadedClasses.clear();
}
}
|
152,979 |
Bug 152979 Optimization: Reference Use and URL Caching in ClassLoader Repository
|
I have found that a lot of memory can get pinned by the BCEL ClassLoaderRepository. For example, on a test configuration of Glassbox with WebLogic over 40 megabytes were pinned in memory due to this loader. (*) I also notice that some of the time spent with loading and parsing redundant classes for shared weaving configuration could be reduced by having a global cache of bytes for URL's instead, i.e., the ClassLoaderRepository is local to a loader, so even if the same class on disk is resolved multiple times in different loaders, it isn't read from cache. This latter issue will be reduced if loading types from a parent loader use reflection delegates instead but BCEL still has to be used for aspects on <1.5 VM's... The attached patch has some metrics in it to measure what's happening and it also uses SoftReferences to cache without pinning the reference types and uses a two-step look up process to maintain a global URL cache. When I run this on WebLogic 9.2 with Glassbox and view their admin console and some smaller apps I get this output: BCEL repository total load time: 7733 ms, in url: 6029 ms for 1427 url cache hits = 1683 missEvicted = 0 missUrlEvicted= 0 all misses = 1427, loader hits = 0 On Tomcat 5.5 with some different sample apps: BCEL repository total load time: 4945 ms, in url: 4319 ms for 636 url cache hits = 548 missEvicted = 0 missUrlEvicted= 190 all misses= 446, loader hits = 3 So at least in my configuration the URL-based cache is quite effective (with almost a 50% hit rate) whereas the loader-based cache provides little value. From what I've seen, it's worth considering not even using the loader-based BCEL cache at all but others may have configurations where it helps. (*) This test was on a development build of AspectJ which I had modified so that the LTWWorld evicts classes after loading
|
resolved fixed
|
387c3ac
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T11:26:28Z | 2006-08-07T14:13:20Z |
bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/AllTests.java
|
/* *******************************************************************
* Copyright (c) 2004 IBM
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
* which accompanies this distribution and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Andy Clement - initial implementation {date}
* ******************************************************************/
package org.aspectj.apache.bcel.classfile.tests;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.aspectj.apache.bcel.classfile.tests.AnnotationAccessFlagTest;
import org.aspectj.apache.bcel.classfile.tests.AnnotationDefaultAttributeTest;
import org.aspectj.apache.bcel.classfile.tests.ElementValueGenTest;
import org.aspectj.apache.bcel.classfile.tests.EnclosingMethodAttributeTest;
import org.aspectj.apache.bcel.classfile.tests.EnumAccessFlagTest;
import org.aspectj.apache.bcel.classfile.tests.FieldAnnotationsTest;
import org.aspectj.apache.bcel.classfile.tests.GeneratingAnnotatedClassesTest;
import org.aspectj.apache.bcel.classfile.tests.LocalVariableTypeTableTest;
import org.aspectj.apache.bcel.classfile.tests.MethodAnnotationsTest;
import org.aspectj.apache.bcel.classfile.tests.RuntimeVisibleAnnotationAttributeTest;
import org.aspectj.apache.bcel.classfile.tests.RuntimeVisibleParameterAnnotationAttributeTest;
import org.aspectj.apache.bcel.classfile.tests.VarargsTest;
public class AllTests {
|
152,979 |
Bug 152979 Optimization: Reference Use and URL Caching in ClassLoader Repository
|
I have found that a lot of memory can get pinned by the BCEL ClassLoaderRepository. For example, on a test configuration of Glassbox with WebLogic over 40 megabytes were pinned in memory due to this loader. (*) I also notice that some of the time spent with loading and parsing redundant classes for shared weaving configuration could be reduced by having a global cache of bytes for URL's instead, i.e., the ClassLoaderRepository is local to a loader, so even if the same class on disk is resolved multiple times in different loaders, it isn't read from cache. This latter issue will be reduced if loading types from a parent loader use reflection delegates instead but BCEL still has to be used for aspects on <1.5 VM's... The attached patch has some metrics in it to measure what's happening and it also uses SoftReferences to cache without pinning the reference types and uses a two-step look up process to maintain a global URL cache. When I run this on WebLogic 9.2 with Glassbox and view their admin console and some smaller apps I get this output: BCEL repository total load time: 7733 ms, in url: 6029 ms for 1427 url cache hits = 1683 missEvicted = 0 missUrlEvicted= 0 all misses = 1427, loader hits = 0 On Tomcat 5.5 with some different sample apps: BCEL repository total load time: 4945 ms, in url: 4319 ms for 636 url cache hits = 548 missEvicted = 0 missUrlEvicted= 190 all misses= 446, loader hits = 3 So at least in my configuration the URL-based cache is quite effective (with almost a 50% hit rate) whereas the loader-based cache provides little value. From what I've seen, it's worth considering not even using the loader-based BCEL cache at all but others may have configurations where it helps. (*) This test was on a development build of AspectJ which I had modified so that the LTWWorld evicts classes after loading
|
resolved fixed
|
387c3ac
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T11:26:28Z | 2006-08-07T14:13:20Z |
bcel-builder/testsrc/org/aspectj/apache/bcel/classfile/tests/AllTests.java
|
public static Test suite() {
TestSuite suite = new TestSuite("Tests for BCEL Java5 support");
suite.addTestSuite(RuntimeVisibleParameterAnnotationAttributeTest.class);
suite.addTestSuite(AnnotationDefaultAttributeTest.class);
suite.addTestSuite(EnclosingMethodAttributeTest.class);
suite.addTestSuite(MethodAnnotationsTest.class);
suite.addTestSuite(RuntimeVisibleAnnotationAttributeTest.class);
suite.addTestSuite(EnumAccessFlagTest.class);
suite.addTestSuite(LocalVariableTypeTableTest.class);
suite.addTestSuite(VarargsTest.class);
suite.addTestSuite(AnnotationAccessFlagTest.class);
suite.addTestSuite(ElementValueGenTest.class);
suite.addTestSuite(FieldAnnotationsTest.class);
suite.addTestSuite(AnnotationGenTest.class);
suite.addTestSuite(ParameterAnnotationsTest.class);
suite.addTestSuite(GeneratingAnnotatedClassesTest.class);
suite.addTestSuite(TypeAnnotationsTest.class);
suite.addTestSuite(UtilTests.class);
suite.addTestSuite(GenericSignatureParsingTest.class);
suite.addTestSuite(GenericsErasureTesting.class);
suite.addTestSuite(AnonymousClassTest.class);
return suite;
}
}
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
/* *******************************************************************
* Copyright (c) 1999-2001 Xerox Corporation,
* 2002 Palo Alto Research Center, Incorporated (PARC).
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
* which accompanies this distribution and is available at
* http:www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Xerox/PARC initial implementation
* ******************************************************************/
package org.aspectj.bridge;
import java.io.*;
import java.util.*;
import org.aspectj.bridge.IMessage.Kind;
import org.aspectj.util.*;
/**
* Convenience API's for constructing, printing, and sending messages.
*/
public class MessageUtil {
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
public static final IMessage ABORT_NOTHING_TO_RUN
= new Message("aborting - nothing to run", IMessage.ABORT, null, null);
public static final IMessage FAIL_INCOMPLETE
= new Message("run not completed", IMessage.FAIL, null, null);
public static final IMessage ABORT_NOMESSAGE
= new Message("", IMessage.ABORT, null, null);
public static final IMessage FAIL_NOMESSAGE
= new Message("", IMessage.FAIL, null, null);
public static final IMessage ERROR_NOMESSAGE
= new Message("", IMessage.ERROR, null, null);
public static final IMessage WARNING_NOMESSAGE
= new Message("", IMessage.WARNING, null, null);
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
public static boolean abort(IMessageHandler handler, String message) {
return ((null != handler)
&& handler.handleMessage(abort(message)));
}
public static boolean abort(IMessageHandler handler, String message, Throwable t) {
if (handler != null) return handler.handleMessage(abort(message, t));
return false;
}
public static boolean fail(IMessageHandler handler, String message) {
return ((null != handler)
&& handler.handleMessage(fail(message)));
}
public static boolean fail(IMessageHandler handler, String message, LineReader reader) {
return ((null != handler)
&& handler.handleMessage(fail(message, reader)));
}
public static boolean fail(IMessageHandler handler, String message, Throwable thrown) {
return ((null != handler)
&& handler.handleMessage(fail(message, thrown)));
}
public static boolean error(IMessageHandler handler, String message) {
return ((null != handler)
&& handler.handleMessage(error(message)));
}
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
public static boolean warn(IMessageHandler handler, String message) {
return ((null != handler)
&& handler.handleMessage(warn(message)));
}
public static boolean debug(IMessageHandler handler, String message) {
return ((null != handler)
&& handler.handleMessage(debug(message)));
}
public static boolean info(IMessageHandler handler, String message) {
return ((null != handler)
&& handler.handleMessage(info(message)));
}
public static IMessage abort(String message) {
if (LangUtil.isEmpty(message)) {
return ABORT_NOMESSAGE;
} else {
return new Message(message, IMessage.ABORT, null, null);
}
}
/** @return abort IMessage with thrown and message o
* ABORT_NOMESSAGE if both are empty/null */
public static IMessage abort(String message, Throwable thrown) {
if (!LangUtil.isEmpty(message)) {
return new Message(message, IMessage.ABORT, thrown, null);
} else if (null == thrown) {
return ABORT_NOMESSAGE;
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
} else {
return new Message(thrown.getMessage(), IMessage.ABORT, thrown, null);
}
}
public static IMessage fail(String message) {
if (LangUtil.isEmpty(message)) {
return FAIL_NOMESSAGE;
} else {
return fail(message, (LineReader) null);
}
}
/**
* Create fail message.
* If message is empty but thrown is not, use thrown.getMessage() as the message.
* If message is empty and thrown is null, return FAIL_NOMESSAGE.
* @return FAIL_NOMESSAGE if thrown is null and message is empty
* or IMessage FAIL with message and thrown otherwise
*/
public static IMessage fail(String message, Throwable thrown) {
if (LangUtil.isEmpty(message)) {
if (null == thrown) {
return FAIL_NOMESSAGE;
} else {
return new Message(thrown.getMessage(), IMessage.FAIL, thrown, null);
}
} else {
return new Message(message, IMessage.FAIL, thrown, null);
}
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
}
/**
* @return IMessage with IMessage.Kind FAIL and message as text
* and soure location from reader
*/
public static IMessage fail(String message, LineReader reader) {
ISourceLocation loc = null;
if (null == reader) {
loc = ISourceLocation.EMPTY;
} else {
int line = (null == reader ? 0 : reader.getLineNumber());
if (0 < line) {
line = 0;
}
loc = new SourceLocation(reader.getFile(), line, line, 0);
}
return new Message(message, IMessage.FAIL, null, loc);
}
public static IMessage error(String message, ISourceLocation location) {
if (LangUtil.isEmpty(message)) {
return ERROR_NOMESSAGE;
} else {
return new Message(message, IMessage.ERROR, null, location);
}
}
public static IMessage warn(String message, ISourceLocation location) {
if (LangUtil.isEmpty(message)) {
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
return WARNING_NOMESSAGE;
} else {
return new Message(message, IMessage.WARNING, null, location);
}
}
public static IMessage error(String message) {
if (LangUtil.isEmpty(message)) {
return ERROR_NOMESSAGE;
} else {
return new Message(message, IMessage.ERROR, null, null);
}
}
public static IMessage warn(String message) {
if (LangUtil.isEmpty(message)) {
return WARNING_NOMESSAGE;
} else {
return new Message(message, IMessage.WARNING, null, null);
}
}
public static IMessage debug(String message) {
return new Message(message, IMessage.DEBUG, null, null);
}
public static IMessage info(String message) {
return new Message(message, IMessage.INFO, null, null);
}
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
public static ISourceLocation makeSourceLocation(LineReader reader) {
LangUtil.throwIaxIfNull(reader, "reader");
int line = reader.getLineNumber();
if (0 < line) {
line = 0;
}
return new SourceLocation(reader.getFile(), line, line, 0);
}
/**
* Print total counts message to the print stream, starting each on a new line
* @param messageHolder
* @param out
*/
public static void printMessageCounts(PrintStream out, IMessageHolder messageHolder) {
if ((null == out) || (null == messageHolder)) {
return;
}
printMessageCounts(out, messageHolder, "");
}
public static void printMessageCounts(PrintStream out, IMessageHolder holder, String prefix) {
out.println(prefix + "MessageHolder: " + MessageUtil.renderCounts(holder));
}
/**
* Print all message to the print stream, starting each on a new line
* @param messageHolder
* @param out
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
* @see #print(PrintStream, String, IMessageHolder, IMessageRenderer, IMessageHandler)
*/
public static void print(PrintStream out, IMessageHolder messageHolder) {
print(out, messageHolder, (String) null, (IMessageRenderer) null, (IMessageHandler) null);
}
/**
* Print all message to the print stream, starting each on a new line,
* with a prefix.
* @param messageHolder
* @param out
* @see #print(PrintStream, String, IMessageHolder, IMessageRenderer, IMessageHandler)
*/
public static void print(PrintStream out, IMessageHolder holder, String prefix) {
print(out, holder, prefix, (IMessageRenderer) null, (IMessageHandler) null);
}
/**
* Print all message to the print stream, starting each on a new line,
* with a prefix and using a renderer.
* @param messageHolder
* @param out
* @param renderer IMessageRender to render result - use MESSAGE_LINE if null
* @see #print(PrintStream, String, IMessageHolder, IMessageRenderer, IMessageHandler)
*/
public static void print(PrintStream out, IMessageHolder holder, String prefix,
IMessageRenderer renderer) {
print(out, holder, prefix, renderer, (IMessageHandler) null);
}
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
/**
* Print all message to the print stream, starting each on a new line,
* with a prefix and using a renderer.
* The first line renders a summary: {prefix}MessageHolder: {summary}
* Each message line has the following form:
* <pre>{prefix}[{kind} {index}]: {rendering}</pre>
* (where "{index}" (length 3) is the position within
* the set of like-kinded messages, ignoring selector omissions.
* Renderers are free to render multi-line output.
* @param out the PrintStream sink - return silently if null
* @param messageHolder the IMessageHolder with the messages to print
* @param renderer IMessageRender to render result - use MESSAGE_ALL if null
* @param selector IMessageHandler to select messages to render - if null, do all non-null
*/
public static void print(PrintStream out, IMessageHolder holder, String prefix,
IMessageRenderer renderer, IMessageHandler selector) {
print(out, holder, prefix, renderer, selector, true);
}
public static void print(PrintStream out, IMessageHolder holder, String prefix,
IMessageRenderer renderer, IMessageHandler selector, boolean printSummary) {
if ((null == out) || (null == holder)) {
return;
}
if (null == renderer) {
renderer = MESSAGE_ALL;
}
if (null == selector) {
selector = PICK_ALL;
}
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
if (printSummary) {
out.println(prefix + "MessageHolder: " + MessageUtil.renderCounts(holder));
}
for (Iterator iter = IMessage.KINDS.iterator(); iter.hasNext();) {
IMessage.Kind kind = (IMessage.Kind) iter.next();
if (!selector.isIgnoring(kind)) {
IMessage[] messages = holder.getMessages(kind, IMessageHolder.EQUAL);
for (int i = 0; i < messages.length; i++) {
if (selector.handleMessage(messages[i])) {
String label = (null == prefix
? ""
: prefix + "[" + kind + " " + LangUtil.toSizedString(i, 3) + "]: ");
out.println(label + renderer.renderToString(messages[i]));
}
}
}
}
}
public static String toShortString(IMessage message) {
if (null == message) {
return "null";
}
String m = message.getMessage();
Throwable t = message.getThrown();
return (message.getKind() + (null == m ? "" : ": " + m)
+ (null == t ? "" : ": " + LangUtil.unqualifiedClassName(t)));
}
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
public static int numMessages(List messages, Kind kind, boolean orGreater) {
if (LangUtil.isEmpty(messages)) {
return 0;
}
IMessageHandler selector = makeSelector(kind, orGreater, null);
IMessage[] result = visitMessages(messages, selector, true, false);
return result.length;
}
/**
* Select all messages in holder except those of the same
* kind (optionally or greater).
* If kind is null, then all messages are rejected,
* so an empty list is returned.
* @return unmodifiable list of specified IMessage
*/
public static IMessage[] getMessagesExcept(IMessageHolder holder,
final IMessage.Kind kind, final boolean orGreater) {
if ((null == holder) || (null == kind)) {
return new IMessage[0];
}
IMessageHandler selector = new IMessageHandler(){
public boolean handleMessage(IMessage message) {
IMessage.Kind test = message.getKind();
return (!(orGreater
? kind.isSameOrLessThan(test)
: kind == test));
}
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
public boolean isIgnoring(Kind kind) {
return false;
}
public void dontIgnore(IMessage.Kind kind) {
;
}
};
return visitMessages(holder, selector, true, false);
}
public static List getMessages(IMessageHolder holder,
IMessage.Kind kind, boolean orGreater, String infix) {
if (null == holder) {
return Collections.EMPTY_LIST;
}
if ((null == kind) && LangUtil.isEmpty(infix)) {
return holder.getUnmodifiableListView();
}
IMessageHandler selector = makeSelector(kind, orGreater, infix);
IMessage[] messages = visitMessages(holder, selector, true, false);
if (LangUtil.isEmpty(messages)) {
return Collections.EMPTY_LIST;
}
return Collections.unmodifiableList(Arrays.asList(messages));
}
/**
* Extract messages of type kind from the input list.
*
* @param messages if null, return EMPTY_LIST
* @param kind if null, return messages
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
* @see MessageHandler#getMessages(Kind)
*/
public static List getMessages(List messages, IMessage.Kind kind) {
if (null == messages) {
return Collections.EMPTY_LIST;
}
if (null == kind) {
return messages;
}
ArrayList result = new ArrayList();
for (Iterator iter = messages.iterator(); iter.hasNext();) {
IMessage element = (IMessage) iter.next();
if (kind == element.getKind()) {
result.add(element);
}
}
if (0 == result.size()) {
return Collections.EMPTY_LIST;
}
return result;
}
/**
* Map to the kind of messages associated with this string key.
* @param kind the String representing the kind of message (IMessage.Kind.toString())
* @return Kind the associated IMessage.Kind, or null if not found
*/
public static IMessage.Kind getKind(String kind) {
if (null != kind) {
kind = kind.toLowerCase();
for (Iterator iter = IMessage.KINDS.iterator(); iter.hasNext();) {
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
IMessage.Kind k = (IMessage.Kind) iter.next();
if (kind.equals(k.toString())) {
return k;
}
}
}
return null;
}
/**
* Run visitor over the set of messages in holder,
* optionally accumulating those accepted by the visitor
*/
public static IMessage[] visitMessages(IMessageHolder holder,
IMessageHandler visitor, boolean accumulate, boolean abortOnFail) {
if (null == holder) {
return IMessage.RA_IMessage;
} else {
return visitMessages(holder.getUnmodifiableListView(), visitor, accumulate, abortOnFail);
}
}
/**
* Run visitor over the set of messages in holder,
* optionally accumulating those accepted by the visitor
*/
public static IMessage[] visitMessages(IMessage[] messages,
IMessageHandler visitor, boolean accumulate, boolean abortOnFail) {
if (LangUtil.isEmpty(messages)) {
return IMessage.RA_IMessage;
} else {
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
return visitMessages(Arrays.asList(messages), visitor, accumulate, abortOnFail);
}
}
/**
* Run visitor over a collection of messages,
* optionally accumulating those accepted by the visitor
* @param messages if null or empty, return IMessage.RA_IMessage
* @param visitor run visitor.handleMessage(message) on each
* message - if null and messages not empty, IllegalArgumentException
* @param accumulate if true, then return accepted IMessage[]
* @param abortOnFail if true and visitor returns false, stop visiting
* @return IMessage.RA_IMessage if collection is empty, if not accumulate,
* or if visitor accepted no IMessage,
* or IMessage[] of accepted messages otherwise
* @throws IllegalArgumentException if any in collection are not instanceof IMessage
*/
public static IMessage[] visitMessages(Collection messages,
IMessageHandler visitor, final boolean accumulate, final boolean abortOnFail) {
if (LangUtil.isEmpty(messages)) {
return IMessage.RA_IMessage;
}
LangUtil.throwIaxIfNull(visitor, "visitor");
ArrayList result = (accumulate ? new ArrayList() : null);
for (Iterator iter = messages.iterator(); iter.hasNext();) {
Object o = iter.next();
LangUtil.throwIaxIfFalse(o instanceof IMessage, "expected IMessage, got " + o);
IMessage m = (IMessage) o;
if (visitor.handleMessage(m)) {
if (accumulate) {
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
result.add(m);
}
} else if (abortOnFail) {
break;
}
}
if (!accumulate || (0 == result.size())) {
return IMessage.RA_IMessage;
} else {
return (IMessage[]) result.toArray(IMessage.RA_IMessage);
}
}
/**
* Make an IMessageHandler that handles IMessage if they have the right kind
* (or greater) and contain some infix String.
* @param kind the IMessage.Kind required of the message
* @param orGreater if true, also accept messages with greater kinds, as
* defined by IMessage.Kind.COMPARATOR
* @param infix the String text to require in the message - may be null or empty
* to accept any message with the specified kind.
* @return IMessageHandler selector that works to param specs
*/
public static IMessageHandler makeSelector(IMessage.Kind kind, boolean orGreater, String infix) {
if (!orGreater && LangUtil.isEmpty(infix)) {
if (kind == IMessage.ABORT) {
return PICK_ABORT;
} else if (kind == IMessage.DEBUG) {
return PICK_DEBUG;
} else if (kind == IMessage.DEBUG) {
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
return PICK_DEBUG;
} else if (kind == IMessage.ERROR) {
return PICK_ERROR;
} else if (kind == IMessage.FAIL) {
return PICK_FAIL;
} else if (kind == IMessage.INFO) {
return PICK_INFO;
} else if (kind == IMessage.WARNING) {
return PICK_WARNING;
}
}
return new KindSelector(kind, orGreater, infix);
}
public static final IMessageHandler PICK_ALL = new KindSelector((IMessage.Kind) null);
public static final IMessageHandler PICK_ABORT = new KindSelector(IMessage.ABORT);
public static final IMessageHandler PICK_DEBUG = new KindSelector(IMessage.DEBUG);
public static final IMessageHandler PICK_ERROR = new KindSelector(IMessage.ERROR);
public static final IMessageHandler PICK_FAIL = new KindSelector(IMessage.FAIL);
public static final IMessageHandler PICK_INFO = new KindSelector(IMessage.INFO);
public static final IMessageHandler PICK_WARNING = new KindSelector(IMessage.WARNING);
public static final IMessageHandler PICK_ABORT_PLUS = new KindSelector(IMessage.ABORT, true);
public static final IMessageHandler PICK_DEBUG_PLUS = new KindSelector(IMessage.DEBUG, true);
public static final IMessageHandler PICK_ERROR_PLUS = new KindSelector(IMessage.ERROR, true);
public static final IMessageHandler PICK_FAIL_PLUS = new KindSelector(IMessage.FAIL, true);
public static final IMessageHandler PICK_INFO_PLUS = new KindSelector(IMessage.INFO, true);
public static final IMessageHandler PICK_WARNING_PLUS = new KindSelector(IMessage.WARNING, true);
private static class KindSelector implements IMessageHandler {
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
final IMessage.Kind sought;
final boolean floor;
final String infix;
KindSelector(IMessage.Kind sought) {
this(sought, false);
}
KindSelector(IMessage.Kind sought, boolean floor) {
this(sought, floor, null);
}
KindSelector(IMessage.Kind sought, boolean floor, String infix) {
this.sought = sought;
this.floor = floor;
this.infix = (LangUtil.isEmpty(infix) ? null : infix);
}
/** @return false if this message is null,
* of true if we seek any kind (null)
* or if this has the exact kind we seek
* and this has any text sought
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
*/
public boolean handleMessage(IMessage message) {
return ((null != message) && !isIgnoring(message.getKind())
&& textIn(message));
}
public boolean isIgnoring(IMessage.Kind kind) {
if (!floor) {
return ((null != sought) && (sought != kind));
} else if (null == sought) {
return false;
} else {
return (0 < IMessage.Kind.COMPARATOR.compare(sought, kind));
}
}
public void dontIgnore(IMessage.Kind kind) {
;
}
private boolean textIn(IMessage message) {
if (null == infix) {
return true;
}
String text = message.getMessage();
return ((null != message) && (-1 != text.indexOf(infix)));
}
}
public static interface IMessageRenderer {
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
String renderToString(IMessage message);
}
public static final IMessageRenderer MESSAGE_SCALED = new IMessageRenderer() {
public String toString() { return "MESSAGE_SCALED"; }
public String renderToString(IMessage message) {
if (null == message) {
return "((IMessage) null)";
}
IMessage.Kind kind = message.getKind();
int level = 3;
if ((kind == IMessage.ABORT) || (kind == IMessage.FAIL)) {
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
level = 1;
} else if ((kind == IMessage.ERROR) || (kind == IMessage.WARNING)) {
level = 2;
} else {
level = 3;
}
String result = null;
switch (level) {
case (1) :
result = MESSAGE_TOSTRING.renderToString(message);
break;
case (2) :
result = MESSAGE_LINE.renderToString(message);
break;
case (3) :
result = MESSAGE_SHORT.renderToString(message);
break;
}
Throwable thrown = message.getThrown();
if (null != thrown) {
if (level == 3) {
result += "Thrown: \n" + LangUtil.renderExceptionShort(thrown);
} else {
result += "Thrown: \n" + LangUtil.renderException(thrown);
}
}
return result;
}
};
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
public static final IMessageRenderer MESSAGE_LABEL = new IMessageRenderer() {
public String toString() { return "MESSAGE_LABEL"; }
public String renderToString(IMessage message) {
if (null == message) {
return "((IMessage) null)";
}
return renderMessageLine(message, 5, 5, 32);
}
};
public static final IMessageRenderer MESSAGE_LABEL_NOLOC = new IMessageRenderer() {
public String toString() { return "MESSAGE_LABEL_NOLOC"; }
public String renderToString(IMessage message) {
if (null == message) {
return "((IMessage) null)";
}
return renderMessageLine(message, 10, 0, 32);
}
};
public static final IMessageRenderer MESSAGE_LINE = new IMessageRenderer() {
public String toString() { return "MESSAGE_LINE"; }
public String renderToString(IMessage message) {
if (null == message) {
return "((IMessage) null)";
}
return renderMessageLine(message, 8, 2, 74);
}
};
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
/** render message as line, i.e., less than 75 char, no internal line sep,
* trying to trim text as needed to end with a full source location */
public static final IMessageRenderer MESSAGE_LINE_FORCE_LOC = new IMessageRenderer() {
public String toString() { return "MESSAGE_LINE_FORCE_LOC"; }
public String renderToString(IMessage message) {
if (null == message) {
return "((IMessage) null)";
}
return renderMessageLine(message, 2, 40, 74);
}
};
public static final IMessageRenderer MESSAGE_ALL = new IMessageRenderer() {
public String toString() { return "MESSAGE_ALL"; }
public String renderToString(IMessage message) {
return renderMessage(message);
}
};
public static final IMessageRenderer MESSAGE_MOST = new IMessageRenderer() {
public String toString() { return "MESSAGE_MOST"; }
public String renderToString(IMessage message) {
if (null == message) {
return "((IMessage) null)";
}
return renderMessageLine(message, 1, 1, 10000);
}
};
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
/** render message as wide line, i.e., less than 256 char, no internal line sep,
* except any Throwable thrown
*/
public static final IMessageRenderer MESSAGE_WIDELINE = new IMessageRenderer() {
public String toString() { return "MESSAGE_WIDELINE"; }
public String renderToString(IMessage message) {
if (null == message) {
return "((IMessage) null)";
}
return renderMessageLine(message, 8, 2, 255);
}
};
public static final IMessageRenderer MESSAGE_TOSTRING = new IMessageRenderer() {
public String toString() { return "MESSAGE_TOSTRING"; }
public String renderToString(IMessage message) {
if (null == message) {
return "((IMessage) null)";
}
return message.toString();
}
};
public static final IMessageRenderer MESSAGE_SHORT = new IMessageRenderer() {
public String toString() { return "MESSAGE_SHORT"; }
public String renderToString(IMessage message) {
return toShortString(message);
}
};
/**
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
* This renders IMessage as String, ignoring empty elements
* and eliding any thrown stack traces.
* @return "((IMessage) null)" if null or String rendering otherwise,
* including everything (esp. throwable stack trace)
* @see renderSourceLocation(ISourceLocation loc)
*/
public static String renderMessage(IMessage message) {
return renderMessage(message, true);
}
/**
* This renders IMessage as String, ignoring empty elements
* and eliding any thrown.
* @return "((IMessage) null)" if null or String rendering otherwise,
* including everything (esp. throwable stack trace)
* @see renderSourceLocation(ISourceLocation loc)
*/
public static String renderMessage(IMessage message, boolean elide) {
if (null == message) {
return "((IMessage) null)";
}
ISourceLocation loc = message.getSourceLocation();
String locString = (null == loc ? "" : " at " + loc);
String result = message.getKind() + locString + " " + message.getMessage();
Throwable thrown = message.getThrown();
if (thrown != null) {
result += " -- " + LangUtil.renderExceptionShort(thrown);
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
result += "\n" + LangUtil.renderException(thrown, elide);
}
if (message.getExtraSourceLocations().isEmpty()) {
return result;
}
else {
return addExtraSourceLocations(message, result);
}
}
public static String addExtraSourceLocations(
IMessage message,
String baseMessage)
{
StringWriter buf = new StringWriter();
PrintWriter writer = new PrintWriter(buf);
writer.println(baseMessage);
for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) {
ISourceLocation element = (ISourceLocation) iter.next();
writer.print("\tsee also: " + element.toString());
if (iter.hasNext()) {
writer.println();
}
}
try { buf.close(); }
catch (IOException ioe) {}
return buf.getBuffer().toString();
}
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
/**
* Render ISourceLocation to String, ignoring empty elements
* (null or ISourceLocation.NO_FILE or ISourceLocation.NO_COLUMN
* (though implementations may return 0 from getColumn() when
* passed NO_COLUMN as input)).
* @return "((ISourceLocation) null)" if null or String rendering
* <pre>{file:}line{:column}</pre>
*
*/
public static String renderSourceLocation(ISourceLocation loc) {
if (null == loc) {
return "((ISourceLocation) null)";
}
StringBuffer sb = new StringBuffer();
File sourceFile = loc.getSourceFile();
if (sourceFile != ISourceLocation.NO_FILE) {
sb.append(sourceFile.getPath());
sb.append(":");
}
int line = loc.getLine();
sb.append("" + line);
int column = loc.getColumn();
if (column != ISourceLocation.NO_COLUMN) {
sb.append(":" + column);
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
}
return sb.toString();
}
/**
* Render message in a line.
* IMessage.Kind is always printed, then any unqualified exception class,
* then the remainder of text and location according to their relative scale,
* all to fit in max characters or less.
* This does not render thrown except for the unqualified class name
* @param max the number of characters - forced to 32..10000
* @param textScale relative proportion to spend on message and/or exception
* message, relative to source location - if 0, message is suppressed
* @param locScale relative proportion to spend on source location
* suppressed if 0
* @return "((IMessage) null)" or message per spec
*/
public static String renderMessageLine(
IMessage message,
int textScale,
int locScale,
int max) {
if (null == message) {
return "((IMessage) null)";
}
if (max < 32) {
max = 32;
} else if (max > 10000) {
max = 10000;
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
}
if (0 > textScale) {
textScale = -textScale;
}
if (0 > locScale) {
locScale = -locScale;
}
String text = message.getMessage();
Throwable thrown = message.getThrown();
ISourceLocation sl = message.getSourceLocation();
IMessage.Kind kind = message.getKind();
StringBuffer result = new StringBuffer();
result.append(kind.toString());
result.append(": ");
if (null != thrown) {
result.append(LangUtil.unqualifiedClassName(thrown) + " ");
if ((null == text) || ("".equals(text))) {
text = thrown.getMessage();
}
}
if (0 == textScale) {
text = "";
} else if ((null != text) && (null != thrown)) {
String s = thrown.getMessage();
if ((null != s) && (0 < s.length())) {
text += " - " + s;
}
}
String loc = "";
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
if ((0 != locScale) && (null != sl)) {
File f = sl.getSourceFile();
if (f == ISourceLocation.NO_FILE) {
f = null;
}
if (null != f) {
loc = f.getName();
}
int line = sl.getLine();
int col = sl.getColumn();
int end = sl.getEndLine();
if ((0 == line) && (0 == col) && (0 == end)) {
} else {
loc += ":" + line + (col == 0 ? "" : ":" + col);
if (line != end) {
loc += ":" + end;
}
}
if (!LangUtil.isEmpty(loc)) {
loc = "@[" + loc;
}
}
float totalScale = locScale + textScale;
float remainder = max - result.length() - 4;
if ((remainder > 0) && (0 < totalScale)) {
int textSize = (int) (remainder * textScale/totalScale);
int locSize = (int) (remainder * locScale/totalScale);
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
int extra = locSize - loc.length();
if (0 < extra) {
locSize = loc.length();
textSize += extra;
}
extra = textSize - text.length();
if (0 < extra) {
textSize = text.length();
if (locSize < loc.length()) {
locSize += extra;
}
}
if (locSize > loc.length()) {
locSize = loc.length();
}
if (textSize > text.length()) {
textSize = text.length();
}
if (0 < textSize) {
result.append(text.substring(0, textSize));
}
if (0 < locSize) {
if (0 < textSize) {
result.append(" ");
}
result.append(loc.substring(0, locSize) + "]");
}
}
return result.toString();
}
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
public static String renderCounts(IMessageHolder holder) {
if (0 == holder.numMessages(null, false)) {
return "(0 messages)";
}
StringBuffer sb = new StringBuffer();
for (Iterator iter = IMessage.KINDS.iterator(); iter.hasNext();) {
IMessage.Kind kind = (IMessage.Kind) iter.next();
int num = holder.numMessages(kind, false);
if (0 < num) {
sb.append(" (" + num + " " + kind + ") ");
}
}
return sb.toString();
}
/**
* Factory for handler adapted to PrintStream
* XXX weak - only handles println(String)
* @param handler the IMessageHandler sink for the messages generated
* @param kind the IMessage.Kind of message to create
* @param overage the OuputStream for text not captured by the handler
* (if null, System.out used)
* @throws IllegalArgumentException if kind or handler is null
*/
public static PrintStream handlerPrintStream(final IMessageHandler handler,
final IMessage.Kind kind, final OutputStream overage, final String prefix) {
LangUtil.throwIaxIfNull(handler, "handler");
LangUtil.throwIaxIfNull(kind, "kind");
class HandlerPrintStream extends PrintStream {
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
HandlerPrintStream() {
super(null == overage ? System.out : overage);
}
public void println() {
println("");
}
public void println(Object o) {
println(null == o ? "null" : o.toString());
}
public void println(String input) {
String textMessage = (null == prefix ? input : prefix + input);
IMessage m = new Message(textMessage, kind, null, null);
handler.handleMessage(m);
}
}
return new HandlerPrintStream();
}
private MessageUtil() {}
/**
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
* Handle all messages in the second handler using the first
* @param handler the IMessageHandler sink for all messages in source
* @param holder the IMessageHolder source for all messages to handle
* @param fastFail if true, stop on first failure
* @return false if any sink.handleMessage(..) failed
*/
public static boolean handleAll(
IMessageHandler sink,
IMessageHolder source,
boolean fastFail) {
return handleAll(sink, source, null, true, fastFail);
}
/**
* Handle messages in the second handler using the first
* @param handler the IMessageHandler sink for all messages in source
* @param holder the IMessageHolder source for all messages to handle
* @param kind the IMessage.Kind to select, if not null
* @param orGreater if true, also accept greater kinds
* @param fastFail if true, stop on first failure
* @return false if any sink.handleMessage(..) failed
*/
public static boolean handleAll(
IMessageHandler sink,
IMessageHolder source,
IMessage.Kind kind,
boolean orGreater,
boolean fastFail) {
LangUtil.throwIaxIfNull(sink, "sink");
LangUtil.throwIaxIfNull(source, "source");
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
return handleAll(sink, source.getMessages(kind, orGreater), fastFail);
}
/**
* Handle messages in the second handler using the first
* if they are NOT of this kind (optionally, or greater).
* If you pass null as the kind, then all messages are
* ignored and this returns true.
* @param handler the IMessageHandler sink for all messages in source
* @param holder the IMessageHolder source for all messages to handle
* @param kind the IMessage.Kind to reject, if not null
* @param orGreater if true, also reject greater kinds
* @param fastFail if true, stop on first failure
* @return false if any sink.handleMessage(..) failed
*/
public static boolean handleAllExcept(
IMessageHandler sink,
IMessageHolder source,
IMessage.Kind kind,
boolean orGreater,
boolean fastFail) {
LangUtil.throwIaxIfNull(sink, "sink");
LangUtil.throwIaxIfNull(source, "source");
if (null == kind) {
return true;
}
IMessage[] messages = getMessagesExcept(source, kind, orGreater);
return handleAll(sink, messages, fastFail);
}
/**
|
152,388 |
Bug 152388 NPE in MessageUtil.addExtraSourceLocations
|
I get this message from an error in a recent dev build of AspectJ with load-time weaving. I don't know how there is a null source location associated with this message, but either it shouldn't be there or MessageUtil line 806 should use this patch: Index: src/org/aspectj/bridge/MessageUtil.java =================================================================== RCS file: /home/technology/org.aspectj/modules/bridge/src/org/aspectj/bridge/MessageUtil.java,v retrieving revision 1.11 diff -u -r1.11 MessageUtil.java --- src/org/aspectj/bridge/MessageUtil.java 1 Jun 2006 09:36:37 -0000 1.11 +++ src/org/aspectj/bridge/MessageUtil.java 31 Jul 2006 22:32:16 -0000 @@ -803,7 +803,7 @@ writer.println(baseMessage); for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { ISourceLocation element = (ISourceLocation) iter.next(); - writer.print("\tsee also: " + element.toString()); + writer.print("\tsee also: " + element); if (iter.hasNext()) { writer.println(); } NPE follows: java.lang.NullPointerException at org.aspectj.bridge.MessageUtil.addExtraSourceLocations(MessageUtil.java:806) at org.aspectj.bridge.MessageUtil.renderMessage(MessageUtil.java:793) at org.aspectj.bridge.Message.toString(Message.java:177) at org.aspectj.bridge.MessageWriter.render(MessageWriter.java:73) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.render(WeavingAdaptor.java:471) at org.aspectj.bridge.MessageWriter.handleMessage(MessageWriter.java:41) at org.aspectj.weaver.tools.WeavingAdaptor$WeavingAdaptorMessageHandler.handleMessage(WeavingAdaptor.java:425) at org.aspectj.weaver.bcel.BcelTypeMunger.error(BcelTypeMunger.java:378) at org.aspectj.weaver.bcel.BcelTypeMunger.enforceDecpRule1_abstractMethodsImplemented(BcelTypeMunger.java:273) at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewParent(BcelTypeMunger.java:194) at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:106) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:450) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:115) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1613) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1564) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1341) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1163) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:288) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:214) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:76) at org.aspectj.ext.ltw13.ClassPreProcessorAdapter.preProcess(ClassPreProcessorAdapter.java:65) at org.codehaus.aspectwerkz.hook.impl.ClassPreProcessorHelper.defineClass0Pre(ClassPreProcessorHelper.java:107) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) ... NOTE: I'm using Alex Vasseur's adaptor to invoke AspectJ LTW from a 1.4 VM, but with recursion protection added. I don't think that should change the expected behavior of Aj.
|
resolved fixed
|
a38edd3
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:48:32Z | 2006-07-31T23:53:20Z |
bridge/src/org/aspectj/bridge/MessageUtil.java
|
* Handle messages in the sink.
* @param handler the IMessageHandler sink for all messages in source
* @param sources the IMessage[] messages to handle
* @param fastFail if true, stop on first failure
* @return false if any sink.handleMessage(..) failed
* @throws IllegalArgumentException if sink is null
*/
public static boolean handleAll(
IMessageHandler sink,
IMessage[] sources,
boolean fastFail) {
LangUtil.throwIaxIfNull(sink, "sink");
if (LangUtil.isEmpty(sources)) {
return true;
}
boolean result = true;
for (int i = 0; i < sources.length; i++) {
if (!sink.handleMessage(sources[i])) {
if (fastFail) {
return false;
}
if (result) {
result = false;
}
}
}
return result;
}
}
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
/*******************************************************************************
* Copyright (c) 2005 Contributors.
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
* which accompanies this distribution and is available at
* http://eclipse.org/legal/epl-v10.html
*
* Contributors:
* Alexandre Vasseur initial implementation
* David Knibb weaving context enhancments
*******************************************************************************/
package org.aspectj.weaver.loadtime;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer;
import org.aspectj.asm.IRelationship;
import org.aspectj.bridge.AbortException;
import org.aspectj.bridge.ISourceLocation;
import org.aspectj.util.LangUtil;
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
import org.aspectj.weaver.ICrossReferenceHandler;
import org.aspectj.weaver.Lint;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.World;
import org.aspectj.weaver.Lint.Kind;
import org.aspectj.weaver.bcel.BcelWeaver;
import org.aspectj.weaver.loadtime.definition.Definition;
import org.aspectj.weaver.loadtime.definition.DocumentParser;
import org.aspectj.weaver.ltw.LTWWorld;
import org.aspectj.weaver.patterns.PatternParser;
import org.aspectj.weaver.patterns.TypePattern;
import org.aspectj.weaver.tools.GeneratedClassHandler;
import org.aspectj.weaver.tools.Trace;
import org.aspectj.weaver.tools.TraceFactory;
import org.aspectj.weaver.tools.WeavingAdaptor;
/**
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
*/
public class ClassLoaderWeavingAdaptor extends WeavingAdaptor {
private final static String AOP_XML = "META-INF/aop.xml";
private boolean initialized;
private List m_dumpTypePattern = new ArrayList();
private boolean m_dumpBefore = false;
private List m_includeTypePattern = new ArrayList();
private List m_excludeTypePattern = new ArrayList();
private List m_includeStartsWith = new ArrayList();
private List m_excludeStartsWith = new ArrayList();
private List m_aspectExcludeTypePattern = new ArrayList();
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
private List m_aspectExcludeStartsWith = new ArrayList();
private List m_aspectIncludeTypePattern = new ArrayList();
private List m_aspectIncludeStartsWith = new ArrayList();
private StringBuffer namespace;
private IWeavingContext weavingContext;
private static Trace trace = TraceFactory.getTraceFactory().getTrace(ClassLoaderWeavingAdaptor.class);
public ClassLoaderWeavingAdaptor() {
super();
if (trace.isTraceEnabled()) trace.enter("<init>",this);
if (trace.isTraceEnabled()) trace.exit("<init>");
}
/**
* We don't need a reference to the class loader and using it during
* construction can cause problems with recursion. It also makes sense
* to supply the weaving context during initialization to.
* @deprecated
*/
public ClassLoaderWeavingAdaptor(final ClassLoader deprecatedLoader, final IWeavingContext deprecatedContext) {
super();
if (trace.isTraceEnabled()) trace.enter("<init>",this,new Object[] { deprecatedLoader, deprecatedContext });
if (trace.isTraceEnabled()) trace.exit("<init>");
}
protected void initialize (final ClassLoader classLoader, IWeavingContext context) {
if (initialized) return;
if (trace.isTraceEnabled()) trace.enter("initialize",this,new Object[] { classLoader, context });
this.weavingContext = context;
if (weavingContext == null) {
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
weavingContext = new DefaultWeavingContext(classLoader);
}
createMessageHandler();
this.generatedClassHandler = new GeneratedClassHandler() {
/**
* Callback when we need to define a Closure in the JVM
*
* @param name
* @param bytes
*/
public void acceptClass(String name, byte[] bytes) {
try {
if (shouldDump(name.replace('/', '.'), false)) {
dump(name, bytes, false);
}
} catch (Throwable throwable) {
throwable.printStackTrace();
}
defineClass(classLoader, name, bytes);
}
};
List definitions = parseDefinitions(classLoader);
if (!enabled) {
if (trace.isTraceEnabled()) trace.exit("initialize",enabled);
return;
}
bcelWorld = new LTWWorld(
classLoader, getMessageHandler(), new ICrossReferenceHandler() {
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
public void addCrossReference(ISourceLocation from, ISourceLocation to, IRelationship.Kind kind, boolean runtimeTest) {
;
}
}
);
weaver = new BcelWeaver(bcelWorld);
registerDefinitions(weaver, classLoader, definitions);
if (enabled) {
weaver.prepareForWeave();
}
else {
bcelWorld = null;
weaver = null;
}
initialized = true;
if (trace.isTraceEnabled()) trace.exit("initialize",enabled);
}
/**
* Load and cache the aop.xml/properties according to the classloader visibility rules
*
* @param weaver
* @param loader
*/
private List parseDefinitions(final ClassLoader loader) {
List definitions = new ArrayList();
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
try {
info("register classloader " + getClassLoaderName(loader));
if (ClassLoader.getSystemClassLoader().equals(loader)) {
String file = System.getProperty("aj5.def", null);
if (file != null) {
info("using (-Daj5.def) " + file);
definitions.add(DocumentParser.parse((new File(file)).toURL()));
}
}
String resourcePath = System.getProperty("org.aspectj.weaver.loadtime.configuration",AOP_XML);
StringTokenizer st = new StringTokenizer(resourcePath,";");
while(st.hasMoreTokens()){
Enumeration xmls = weavingContext.getResources(st.nextToken());
while (xmls.hasMoreElements()) {
URL xml = (URL) xmls.nextElement();
info("using configuration " + weavingContext.getFile(xml));
definitions.add(DocumentParser.parse(xml));
}
}
if (definitions.isEmpty()) {
enabled = false;
info("no configuration found. Disabling weaver for class loader " + getClassLoaderName(loader));
}
} catch (Exception e) {
enabled = false;
warn("parse definitions failed",e);
}
return definitions;
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
}
private void registerDefinitions(final BcelWeaver weaver, final ClassLoader loader, List definitions) {
try {
registerOptions(weaver, loader, definitions);
registerAspectExclude(weaver, loader, definitions);
registerAspectInclude(weaver, loader, definitions);
registerAspects(weaver, loader, definitions);
registerIncludeExclude(weaver, loader, definitions);
registerDump(weaver, loader, definitions);
} catch (Exception e) {
enabled = false;
warn("register definition failed",(e instanceof AbortException)?null:e);
}
}
private String getClassLoaderName (ClassLoader loader) {
return weavingContext.getClassLoaderName();
}
/**
* Configure the weaver according to the option directives
* TODO av - don't know if it is that good to reuse, since we only allow a small subset of options in LTW
*
* @param weaver
* @param loader
* @param definitions
*/
private void registerOptions(final BcelWeaver weaver, final ClassLoader loader, final List definitions) {
StringBuffer allOptions = new StringBuffer();
for (Iterator iterator = definitions.iterator(); iterator.hasNext();) {
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
Definition definition = (Definition) iterator.next();
allOptions.append(definition.getWeaverOptions()).append(' ');
}
Options.WeaverOption weaverOption = Options.parse(allOptions.toString(), loader, getMessageHandler());
World world = weaver.getWorld();
setMessageHandler(weaverOption.messageHandler);
world.setXlazyTjp(weaverOption.lazyTjp);
world.setXHasMemberSupportEnabled(weaverOption.hasMember);
world.setOptionalJoinpoints(weaverOption.optionalJoinpoints);
world.setPinpointMode(weaverOption.pinpoint);
weaver.setReweavableMode(weaverOption.notReWeavable);
world.setXnoInline(weaverOption.noInline);
world.setBehaveInJava5Way(LangUtil.is15VMOrGreater());
world.setAddSerialVerUID(weaverOption.addSerialVersionUID);
bcelWorld.getLint().loadDefaultProperties();
bcelWorld.getLint().adviceDidNotMatch.setKind(null);
if (weaverOption.lintFile != null) {
InputStream resource = null;
try {
resource = loader.getResourceAsStream(weaverOption.lintFile);
Exception failure = null;
if (resource != null) {
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
try {
Properties properties = new Properties();
properties.load(resource);
world.getLint().setFromProperties(properties);
} catch (IOException e) {
failure = e;
}
}
if (failure != null || resource == null) {
warn("Cannot access resource for -Xlintfile:"+weaverOption.lintFile,failure);
}
} finally {
try { resource.close(); } catch (Throwable t) {;}
}
}
if (weaverOption.lint != null) {
if (weaverOption.lint.equals("default")) {
bcelWorld.getLint().loadDefaultProperties();
} else {
bcelWorld.getLint().setAll(weaverOption.lint);
}
}
}
private void registerAspectExclude(final BcelWeaver weaver, final ClassLoader loader, final List definitions) {
String fastMatchInfo = null;
for (Iterator iterator = definitions.iterator(); iterator.hasNext();) {
Definition definition = (Definition) iterator.next();
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
for (Iterator iterator1 = definition.getAspectExcludePatterns().iterator(); iterator1.hasNext();) {
String exclude = (String) iterator1.next();
TypePattern excludePattern = new PatternParser(exclude).parseTypePattern();
m_aspectExcludeTypePattern.add(excludePattern);
fastMatchInfo = looksLikeStartsWith(exclude);
if (fastMatchInfo != null) {
m_aspectExcludeStartsWith.add(fastMatchInfo);
}
}
}
}
private void registerAspectInclude(final BcelWeaver weaver, final ClassLoader loader, final List definitions) {
String fastMatchInfo = null;
for (Iterator iterator = definitions.iterator(); iterator.hasNext();) {
Definition definition = (Definition) iterator.next();
for (Iterator iterator1 = definition.getAspectIncludePatterns().iterator(); iterator1.hasNext();) {
String include = (String) iterator1.next();
TypePattern includePattern = new PatternParser(include).parseTypePattern();
m_aspectIncludeTypePattern.add(includePattern);
fastMatchInfo = looksLikeStartsWith(include);
if (fastMatchInfo != null) {
m_aspectIncludeStartsWith.add(fastMatchInfo);
}
}
}
}
protected void lint (String name, String[] infos) {
Lint lint = bcelWorld.getLint();
Kind kind = lint.getLintKind(name);
kind.signal(infos,null,null);
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
}
protected String getContextId () {
return weavingContext.getId();
}
/**
* Register the aspect, following include / exclude rules
*
* @param weaver
* @param loader
* @param definitions
*/
private void registerAspects(final BcelWeaver weaver, final ClassLoader loader, final List definitions) {
if (trace.isTraceEnabled()) trace.enter("registerAspects",this, new Object[] { weaver, loader, definitions} );
for (Iterator iterator = definitions.iterator(); iterator.hasNext();) {
Definition definition = (Definition) iterator.next();
for (Iterator aspects = definition.getAspectClassNames().iterator(); aspects.hasNext();) {
String aspectClassName = (String) aspects.next();
if (acceptAspect(aspectClassName)) {
info("register aspect " + aspectClassName);
weaver.addLibraryAspect(aspectClassName);
if(namespace==null){
namespace=new StringBuffer(aspectClassName);
}else{
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
namespace = namespace.append(";"+aspectClassName);
}
}
else {
lint("aspectExcludedByConfiguration", new String[] { aspectClassName, getClassLoaderName(loader) });
}
}
}
for (Iterator iterator = definitions.iterator(); iterator.hasNext();) {
Definition definition = (Definition) iterator.next();
for (Iterator aspects = definition.getConcreteAspects().iterator(); aspects.hasNext();) {
Definition.ConcreteAspect concreteAspect = (Definition.ConcreteAspect) aspects.next();
if (acceptAspect(concreteAspect.name)) {
ConcreteAspectCodeGen gen = new ConcreteAspectCodeGen(concreteAspect, weaver.getWorld());
if (!gen.validate()) {
error("Concrete-aspect '"+concreteAspect.name+"' could not be registered");
break;
}
this.generatedClassHandler.acceptClass(
concreteAspect.name,
gen.getBytes()
);
weaver.addLibraryAspect(concreteAspect.name);
if(namespace==null){
namespace=new StringBuffer(concreteAspect.name);
}else{
namespace = namespace.append(";"+concreteAspect.name);
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
}
}
}
}
if (namespace == null) {
enabled = false;
info("no aspects registered. Disabling weaver for class loader " + getClassLoaderName(loader));
}
if (trace.isTraceEnabled()) trace.exit("registerAspects",enabled);
}
/**
* Register the include / exclude filters
* We duplicate simple patterns in startWith filters that will allow faster matching without ResolvedType
*
* @param weaver
* @param loader
* @param definitions
*/
private void registerIncludeExclude(final BcelWeaver weaver, final ClassLoader loader, final List definitions) {
String fastMatchInfo = null;
for (Iterator iterator = definitions.iterator(); iterator.hasNext();) {
Definition definition = (Definition) iterator.next();
for (Iterator iterator1 = definition.getIncludePatterns().iterator(); iterator1.hasNext();) {
String include = (String) iterator1.next();
TypePattern includePattern = new PatternParser(include).parseTypePattern();
m_includeTypePattern.add(includePattern);
fastMatchInfo = looksLikeStartsWith(include);
if (fastMatchInfo != null) {
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
m_includeStartsWith.add(fastMatchInfo);
}
}
for (Iterator iterator1 = definition.getExcludePatterns().iterator(); iterator1.hasNext();) {
String exclude = (String) iterator1.next();
TypePattern excludePattern = new PatternParser(exclude).parseTypePattern();
m_excludeTypePattern.add(excludePattern);
fastMatchInfo = looksLikeStartsWith(exclude);
if (fastMatchInfo != null) {
m_excludeStartsWith.add(fastMatchInfo);
}
}
}
}
/**
* Checks if the type pattern can be handled as a startswith check
*
* TODO AV - enhance to support "char.sss" ie FQN direclty (match iff equals)
* we could also add support for "*..*charss" endsWith style?
*
* @param typePattern
* @return null if not possible, or the startWith sequence to test against
*/
private String looksLikeStartsWith(String typePattern) {
if (typePattern.indexOf('@') >= 0
|| typePattern.indexOf('+') >= 0
|| typePattern.indexOf(' ') >= 0
|| typePattern.charAt(typePattern.length()-1) != '*') {
return null;
}
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
int length = typePattern.length();
if (typePattern.endsWith("..*") && length > 3) {
if (typePattern.indexOf("..") == length-3
&& typePattern.indexOf('*') == length-1) {
return typePattern.substring(0, length-2).replace('$', '.');
}
}
return null;
}
/**
* Register the dump filter
*
* @param weaver
* @param loader
* @param definitions
*/
private void registerDump(final BcelWeaver weaver, final ClassLoader loader, final List definitions) {
for (Iterator iterator = definitions.iterator(); iterator.hasNext();) {
Definition definition = (Definition) iterator.next();
for (Iterator iterator1 = definition.getDumpPatterns().iterator(); iterator1.hasNext();) {
String dump = (String) iterator1.next();
TypePattern pattern = new PatternParser(dump).parseTypePattern();
m_dumpTypePattern.add(pattern);
}
if (definition.shouldDumpBefore()) {
m_dumpBefore = true;
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
}
}
}
protected boolean accept(String className, byte[] bytes) {
if (m_excludeTypePattern.isEmpty() && m_includeTypePattern.isEmpty()) {
return true;
}
String fastClassName = className.replace('/', '.').replace('$', '.');
for (int i = 0; i < m_excludeStartsWith.size(); i++) {
if (fastClassName.startsWith((String)m_excludeStartsWith.get(i))) {
return false;
}
}
/*
* Bug 120363
* If we have an exclude pattern that cannot be matched using "starts with"
* then we cannot fast accept
*/
if (m_excludeTypePattern.isEmpty()) {
boolean fastAccept = false;
for (int i = 0; i < m_includeStartsWith.size(); i++) {
fastAccept = fastClassName.startsWith((String)m_includeStartsWith.get(i));
if (fastAccept) {
break;
}
}
}
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
ensureDelegateInitialized(className,bytes);
ResolvedType classInfo = delegateForCurrentClass.getResolvedTypeX();
for (Iterator iterator = m_excludeTypePattern.iterator(); iterator.hasNext();) {
TypePattern typePattern = (TypePattern) iterator.next();
if (typePattern.matchesStatically(classInfo)) {
return false;
}
}
boolean accept = true;
for (Iterator iterator = m_includeTypePattern.iterator(); iterator.hasNext();) {
TypePattern typePattern = (TypePattern) iterator.next();
accept = typePattern.matchesStatically(classInfo);
if (accept) {
break;
}
}
return accept;
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
}
private boolean acceptAspect(String aspectClassName) {
if (m_aspectExcludeTypePattern.isEmpty() && m_aspectIncludeTypePattern.isEmpty()) {
return true;
}
String fastClassName = aspectClassName.replace('/', '.').replace('.', '$');
for (int i = 0; i < m_aspectExcludeStartsWith.size(); i++) {
if (fastClassName.startsWith((String)m_aspectExcludeStartsWith.get(i))) {
return false;
}
}
for (int i = 0; i < m_aspectIncludeStartsWith.size(); i++) {
if (fastClassName.startsWith((String)m_aspectIncludeStartsWith.get(i))) {
return true;
}
}
ResolvedType classInfo = weaver.getWorld().resolve(UnresolvedType.forName(aspectClassName), true);
for (Iterator iterator = m_aspectExcludeTypePattern.iterator(); iterator.hasNext();) {
TypePattern typePattern = (TypePattern) iterator.next();
if (typePattern.matchesStatically(classInfo)) {
return false;
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
}
}
boolean accept = true;
for (Iterator iterator = m_aspectIncludeTypePattern.iterator(); iterator.hasNext();) {
TypePattern typePattern = (TypePattern) iterator.next();
accept = typePattern.matchesStatically(classInfo);
if (accept) {
break;
}
}
return accept;
}
protected boolean shouldDump(String className, boolean before) {
if (before && !m_dumpBefore) {
return false;
}
if (m_dumpTypePattern.isEmpty()) {
return false;
}
ResolvedType classInfo = weaver.getWorld().resolve(UnresolvedType.forName(className), true);
for (Iterator iterator = m_dumpTypePattern.iterator(); iterator.hasNext();) {
TypePattern typePattern = (TypePattern) iterator.next();
if (typePattern.matchesStatically(classInfo)) {
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
return true;
}
}
return false;
}
/*
* shared classes methods
*/
/**
* @return Returns the key.
*/
public String getNamespace() {
if(namespace==null) return "";
else return new String(namespace);
}
/**
* Check to see if any classes are stored in the generated classes cache.
* Then flush the cache if it is not empty
* @param className TODO
* @return true if a class has been generated and is stored in the cache
*/
public boolean generatedClassesExistFor (String className) {
if (className == null) return !generatedClasses.isEmpty();
else return generatedClasses.containsKey(className);
}
/**
* Flush the generated classes cache
*/
public void flushGeneratedClasses() {
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
|
generatedClasses = new HashMap();
}
private void defineClass(ClassLoader loader, String name, byte[] bytes) {
if (trace.isTraceEnabled()) trace.enter("defineClass",this,new Object[] {loader,name,bytes});
Object clazz = null;
info("generating class '" + name + "'");
try {
Method defineClass = ClassLoader.class.getDeclaredMethod(
"defineClass", new Class[] { String.class,
bytes.getClass(), int.class, int.class });
defineClass.setAccessible(true);
clazz = defineClass.invoke(loader, new Object[] { name, bytes,
new Integer(0), new Integer(bytes.length) });
} catch (InvocationTargetException e) {
if (e.getTargetException() instanceof LinkageError) {
warn("define generated class failed",e.getTargetException());
} else {
warn("define generated class failed",e.getTargetException());
}
} catch (Exception e) {
warn("define generated class failed",e);
}
if (trace.isTraceEnabled()) trace.exit("defineClass",clazz);
}
}
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/Options.java
|
/*******************************************************************************
* Copyright (c) 2005 Contributors.
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
* which accompanies this distribution and is available at
* http://eclipse.org/legal/epl-v10.html
*
* Contributors:
* Alexandre Vasseur initial implementation
*******************************************************************************/
package org.aspectj.weaver.loadtime;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.IMessageHandler;
import org.aspectj.bridge.Message;
import org.aspectj.util.LangUtil;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
/**
* A class that hanldes LTW options.
* Note: AV - I choosed to not reuse AjCompilerOptions and alike since those implies too many dependancies on
* jdt and ajdt modules.
*
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
*/
public class Options {
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/Options.java
|
private final static String OPTION_15 = "-1.5";
private final static String OPTION_lazyTjp = "-XlazyTjp";
private final static String OPTION_noWarn = "-nowarn";
private final static String OPTION_noWarnNone = "-warn:none";
private final static String OPTION_proceedOnError = "-proceedOnError";
private final static String OPTION_verbose = "-verbose";
private final static String OPTION_reweavable = "-Xreweavable";
private final static String OPTION_noinline = "-Xnoinline";
private final static String OPTION_addSerialVersionUID = "-XaddSerialVersionUID";
private final static String OPTION_hasMember = "-XhasMember";
private final static String OPTION_pinpoint = "-Xdev:pinpoint";
private final static String OPTION_showWeaveInfo = "-showWeaveInfo";
private final static String OPTIONVALUED_messageHandler = "-XmessageHandlerClass:";
private static final String OPTIONVALUED_Xlintfile = "-Xlintfile:";
private static final String OPTIONVALUED_Xlint = "-Xlint:";
private static final String OPTIONVALUED_joinpoints = "-Xjoinpoints:";
public static WeaverOption parse(String options, ClassLoader laoder, IMessageHandler imh) {
WeaverOption weaverOption = new WeaverOption(imh);
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/Options.java
|
if (LangUtil.isEmpty(options)) {
return weaverOption;
}
List flags = LangUtil.anySplit(options, " ");
Collections.reverse(flags);
for (Iterator iterator = flags.iterator(); iterator.hasNext();) {
String arg = (String) iterator.next();
if (arg.startsWith(OPTIONVALUED_messageHandler)) {
if (arg.length() > OPTIONVALUED_messageHandler.length()) {
String handlerClass = arg.substring(OPTIONVALUED_messageHandler.length()).trim();
try {
Class handler = Class.forName(handlerClass, false, laoder);
weaverOption.messageHandler = ((IMessageHandler) handler.newInstance());
} catch (Throwable t) {
weaverOption.messageHandler.handleMessage(
new Message(
"Cannot instantiate message handler " + handlerClass,
IMessage.ERROR,
t,
null
)
);
}
}
}
}
for (Iterator iterator = flags.iterator(); iterator.hasNext();) {
|
152,161 |
Bug 152161 Contribution: Support -Xset in Load-Time Weaving Configuration
|
I needed this to try out a setting in the pipelined compilation (-Xset:runMinimalMemory=true) ... I was able to verify that it parsed and set an option correctly in the debugger. I also have included a test that sets all the currently available options.
|
resolved fixed
|
039be68
|
AspectJ
|
https://github.com/eclipse/org.aspectj
|
eclipse/org.aspectj
|
java
| null | null | null | 2006-08-08T13:50:57Z | 2006-07-28T15:20:00Z |
loadtime/src/org/aspectj/weaver/loadtime/Options.java
|
String arg = (String) iterator.next();
if (arg.equals(OPTION_15)) {
weaverOption.java5 = true;
} else if (arg.equalsIgnoreCase(OPTION_lazyTjp)) {
weaverOption.lazyTjp = true;
} else if (arg.equalsIgnoreCase(OPTION_noinline)) {
weaverOption.noInline = true;
} else if (arg.equalsIgnoreCase(OPTION_addSerialVersionUID)) {
weaverOption.addSerialVersionUID=true;
} else if (arg.equalsIgnoreCase(OPTION_noWarn) || arg.equalsIgnoreCase(OPTION_noWarnNone)) {
weaverOption.noWarn = true;
} else if (arg.equalsIgnoreCase(OPTION_proceedOnError)) {
weaverOption.proceedOnError = true;
} else if (arg.equalsIgnoreCase(OPTION_reweavable)) {
weaverOption.notReWeavable = false;
} else if (arg.equalsIgnoreCase(OPTION_showWeaveInfo)) {
weaverOption.showWeaveInfo = true;
} else if (arg.equalsIgnoreCase(OPTION_hasMember)) {
weaverOption.hasMember = true;
} else if (arg.startsWith(OPTIONVALUED_joinpoints)) {
if (arg.length()>OPTIONVALUED_joinpoints.length())
weaverOption.optionalJoinpoints = arg.substring(OPTIONVALUED_joinpoints.length()).trim();
} else if (arg.equalsIgnoreCase(OPTION_verbose)) {
weaverOption.verbose = true;
} else if (arg.equalsIgnoreCase(OPTION_pinpoint)) {
weaverOption.pinpoint = true;
} else if (arg.startsWith(OPTIONVALUED_messageHandler)) {
;
} else if (arg.startsWith(OPTIONVALUED_Xlintfile)) {
if (arg.length() > OPTIONVALUED_Xlintfile.length()) {
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.