panel.add(label,BorderLayout.WEST); | panel.add(label,BorderLayout.WEST); | ||||
JComboBox warnings = new JComboBox(ignoreOrWarning); | JComboBox warnings = new JComboBox(ignoreOrWarning); | ||||
String value = (String) javaBuildOptions.getJavaBuildOptionsMap().get(javaOptionToSet); | |||||
String value = javaBuildOptions.getJavaBuildOptionsMap().get(javaOptionToSet); | |||||
if (value.equals(JavaOptions.IGNORE)) { | if (value.equals(JavaOptions.IGNORE)) { | ||||
warnings.setSelectedIndex(0); | warnings.setSelectedIndex(0); | ||||
} else { | } else { |
characterEncoding.setPreferredSize(new Dimension(150, 21)); | characterEncoding.setPreferredSize(new Dimension(150, 21)); | ||||
panel.add(characterEncoding,BorderLayout.EAST); | panel.add(characterEncoding,BorderLayout.EAST); | ||||
String option = (String) javaBuildOptions.getJavaBuildOptionsMap().get( | |||||
String option = javaBuildOptions.getJavaBuildOptionsMap().get( | |||||
JavaOptions.CHARACTER_ENCODING); | JavaOptions.CHARACTER_ENCODING); | ||||
if (option != null) { | if (option != null) { | ||||
characterEncoding.setText(option); | characterEncoding.setText(option); |
public static String getPackageDeclarationFromFile(AsmManager model, File file) { | public static String getPackageDeclarationFromFile(AsmManager model, File file) { | ||||
IProgramElement fileNode = model.getHierarchy().findElementForSourceFile(file.getAbsolutePath()); | IProgramElement fileNode = model.getHierarchy().findElementForSourceFile(file.getAbsolutePath()); | ||||
String packageName = ((IProgramElement) fileNode.getChildren().get(0)).getPackageName(); | |||||
String packageName = fileNode.getChildren().get(0).getPackageName(); | |||||
return packageName; | return packageName; | ||||
} | } | ||||
for (int i = 0; i < node.getParameterTypes().size(); i++) { | for (int i = 0; i < node.getParameterTypes().size(); i++) { | ||||
sb.append(String.valueOf(node.getParameterTypes().get(i))); | sb.append(String.valueOf(node.getParameterTypes().get(i))); | ||||
sb.append(' '); | sb.append(' '); | ||||
sb.append((String) node.getParameterNames().get(i)); | |||||
sb.append(node.getParameterNames().get(i)); | |||||
if (i < node.getParameterTypes().size() - 1) { | if (i < node.getParameterTypes().size() - 1) { | ||||
sb.append(", "); | sb.append(", "); | ||||
} | } |
* @param max_gap maximum gap that may between case branches | * @param max_gap maximum gap that may between case branches | ||||
*/ | */ | ||||
public SwitchBuilder(int[] match, InstructionHandle[] targets,InstructionHandle target, int max_gap) { | public SwitchBuilder(int[] match, InstructionHandle[] targets,InstructionHandle target, int max_gap) { | ||||
this.match = (int[])match.clone(); | |||||
this.targets = (InstructionHandle[])targets.clone(); | |||||
this.match = match.clone(); | |||||
this.targets = targets.clone(); | |||||
if((match_length = match.length) < 2) // (almost) empty switch, or just default | if((match_length = match.length) < 2) // (almost) empty switch, or just default | ||||
if (match.length==0) { | if (match.length==0) { |
if (null == name) { | if (null == name) { | ||||
return null; | return null; | ||||
} | } | ||||
Module result = (Module) modules.get(name); | |||||
Module result = modules.get(name); | |||||
if (null == result) { | if (null == result) { | ||||
File moduleDir = new File(baseDir, name); | File moduleDir = new File(baseDir, name); | ||||
if (!Util.canReadDir(moduleDir)) { | if (!Util.canReadDir(moduleDir)) { |
if (parser.classpath == null) { | if (parser.classpath == null) { | ||||
addClasspath(System.getProperty("java.class.path", ""), ret); | addClasspath(System.getProperty("java.class.path", ""), ret); | ||||
List<String> fixedList = new ArrayList<>(); | List<String> fixedList = new ArrayList<>(); | ||||
for (Object o : ret) { | |||||
String entry = (String) o; | |||||
for (String entry : ret) { | |||||
if (!entry.endsWith("aspectjtools.jar")) { | if (!entry.endsWith("aspectjtools.jar")) { | ||||
fixedList.add(entry); | fixedList.add(entry); | ||||
} | } |
private List<InterimCompilationResult> getBinarySourcesFrom(Map<String, List<UnwovenClassFile>> binarySourceEntries) { | private List<InterimCompilationResult> getBinarySourcesFrom(Map<String, List<UnwovenClassFile>> binarySourceEntries) { | ||||
// Map is fileName |-> List<UnwovenClassFile> | // Map is fileName |-> List<UnwovenClassFile> | ||||
List<InterimCompilationResult> ret = new ArrayList<>(); | List<InterimCompilationResult> ret = new ArrayList<>(); | ||||
for (Object o : binarySourceEntries.keySet()) { | |||||
String sourceFileName = (String) o; | |||||
for (String sourceFileName : binarySourceEntries.keySet()) { | |||||
List<UnwovenClassFile> unwovenClassFiles = binarySourceEntries.get(sourceFileName); | List<UnwovenClassFile> unwovenClassFiles = binarySourceEntries.get(sourceFileName); | ||||
// XXX - see bugs 57432,58679 - final parameter on next call should be "compiler.options.maxProblemsPerUnit" | // XXX - see bugs 57432,58679 - final parameter on next call should be "compiler.options.maxProblemsPerUnit" | ||||
CompilationResult result = new CompilationResult(sourceFileName.toCharArray(), 0, 0, Integer.MAX_VALUE); | CompilationResult result = new CompilationResult(sourceFileName.toCharArray(), 0, 0, Integer.MAX_VALUE); | ||||
} | } | ||||
private void notifyRequestor() { | private void notifyRequestor() { | ||||
for (Object o : resultsPendingWeave) { | |||||
InterimCompilationResult iresult = (InterimCompilationResult) o; | |||||
for (InterimCompilationResult iresult : resultsPendingWeave) { | |||||
compiler.requestor.acceptResult(iresult.result().tagAsAccepted()); | compiler.requestor.acceptResult(iresult.result().tagAsAccepted()); | ||||
} | } | ||||
} | } | ||||
private void weave() throws IOException { | private void weave() throws IOException { | ||||
// ensure weaver state is set up correctly | // ensure weaver state is set up correctly | ||||
for (Object o : resultsPendingWeave) { | |||||
InterimCompilationResult iresult = (InterimCompilationResult) o; | |||||
for (InterimCompilationResult iresult : resultsPendingWeave) { | |||||
for (int i = 0; i < iresult.unwovenClassFiles().length; i++) { | for (int i = 0; i < iresult.unwovenClassFiles().length; i++) { | ||||
weaver.addClassFile(iresult.unwovenClassFiles()[i], false); | weaver.addClassFile(iresult.unwovenClassFiles()[i], false); | ||||
} | } |
if (nowProcessing == null) { | if (nowProcessing == null) { | ||||
if (!resultIterator.hasNext()) | if (!resultIterator.hasNext()) | ||||
return false; | return false; | ||||
nowProcessing = (InterimCompilationResult) resultIterator.next(); | |||||
nowProcessing = resultIterator.next(); | |||||
classFileIndex = 0; | classFileIndex = 0; | ||||
} | } | ||||
while (nowProcessing.unwovenClassFiles().length == 0) { | while (nowProcessing.unwovenClassFiles().length == 0) { | ||||
if (!resultIterator.hasNext()) | if (!resultIterator.hasNext()) | ||||
return false; | return false; | ||||
nowProcessing = (InterimCompilationResult) resultIterator.next(); | |||||
nowProcessing = resultIterator.next(); | |||||
} | } | ||||
if (classFileIndex < nowProcessing.unwovenClassFiles().length) { | if (classFileIndex < nowProcessing.unwovenClassFiles().length) { | ||||
return true; | return true; | ||||
classFileIndex = 0; | classFileIndex = 0; | ||||
if (!resultIterator.hasNext()) | if (!resultIterator.hasNext()) | ||||
return false; | return false; | ||||
nowProcessing = (InterimCompilationResult) resultIterator.next(); | |||||
nowProcessing = resultIterator.next(); | |||||
while (nowProcessing.unwovenClassFiles().length == 0) { | while (nowProcessing.unwovenClassFiles().length == 0) { | ||||
if (!resultIterator.hasNext()) | if (!resultIterator.hasNext()) | ||||
return false; | return false; | ||||
nowProcessing = (InterimCompilationResult) resultIterator.next(); | |||||
nowProcessing = resultIterator.next(); | |||||
} | } | ||||
} | } | ||||
return true; | return true; |
boolean usedBinarySourceFileName) { | boolean usedBinarySourceFileName) { | ||||
List<IProblem> ret = new ArrayList<>(); | List<IProblem> ret = new ArrayList<>(); | ||||
for (Object sourceLocation : sourceLocations) { | |||||
ISourceLocation loc = (ISourceLocation) sourceLocation; | |||||
for (ISourceLocation loc : sourceLocations) { | |||||
if (loc != null) { | if (loc != null) { | ||||
DefaultProblem dp = new DefaultProblem(loc.getSourceFile().getPath().toCharArray(), "see also", 0, new String[]{}, | DefaultProblem dp = new DefaultProblem(loc.getSourceFile().getPath().toCharArray(), "see also", 0, new String[]{}, | ||||
ProblemSeverities.Ignore, getStartPos(loc, null), getEndPos(loc, null), loc.getLine(), loc.getColumn()); | ProblemSeverities.Ignore, getStartPos(loc, null), getEndPos(loc, null), loc.getLine(), loc.getColumn()); | ||||
ProblemSeverities.Ignore, 0, 0, 0, 0); | ProblemSeverities.Ignore, 0, 0, 0, 0); | ||||
ret.add(dp); | ret.add(dp); | ||||
} | } | ||||
IProblem[] retValue = (IProblem[]) ret.toArray(new IProblem[] {}); | |||||
IProblem[] retValue = ret.toArray(new IProblem[] {}); | |||||
return retValue; | return retValue; | ||||
} | } | ||||
ResolvedMember m = world.makeResolvedMember(binding); | ResolvedMember m = world.makeResolvedMember(binding); | ||||
ResolvedMember superAccessMember = AjcMemberMaker.superAccessMethod(inAspect.typeX, m); | ResolvedMember superAccessMember = AjcMemberMaker.superAccessMethod(inAspect.typeX, m); | ||||
if (inAspect.superAccessForInline.containsKey(superAccessMember)) { | if (inAspect.superAccessForInline.containsKey(superAccessMember)) { | ||||
return ((SuperAccessMethodPair) inAspect.superAccessForInline.get(superAccessMember)).accessMethod; | |||||
return inAspect.superAccessForInline.get(superAccessMember).accessMethod; | |||||
} | } | ||||
MethodBinding ret = world.makeMethodBinding(superAccessMember); | MethodBinding ret = world.makeMethodBinding(superAccessMember); | ||||
inAspect.superAccessForInline.put(superAccessMember, new SuperAccessMethodPair(m, ret)); | inAspect.superAccessForInline.put(superAccessMember, new SuperAccessMethodPair(m, ret)); |
Collection<UnresolvedType> parentPatterns = dp.getParents().getExactTypes(); | Collection<UnresolvedType> parentPatterns = dp.getParents().getExactTypes(); | ||||
StringBuilder parents = new StringBuilder(); | StringBuilder parents = new StringBuilder(); | ||||
for (Iterator<UnresolvedType> iter = parentPatterns.iterator(); iter.hasNext();) { | for (Iterator<UnresolvedType> iter = parentPatterns.iterator(); iter.hasNext();) { | ||||
UnresolvedType urt = ((UnresolvedType) iter.next()); | |||||
UnresolvedType urt = iter.next(); | |||||
parents.append(urt.getName()); | parents.append(urt.getName()); | ||||
if (iter.hasNext()) { | if (iter.hasNext()) { | ||||
parents.append(", "); | parents.append(", "); |
private boolean insideAspect() { | private boolean insideAspect() { | ||||
if (typeStack.empty()) | if (typeStack.empty()) | ||||
return false; | return false; | ||||
TypeDeclaration typeDecl = (TypeDeclaration) typeStack.peek(); | |||||
TypeDeclaration typeDecl = typeStack.peek(); | |||||
return isAspect(typeDecl); | return isAspect(typeDecl); | ||||
} | } | ||||
UnresolvedType[] paramTypes = new UnresolvedType[bindings.length]; | UnresolvedType[] paramTypes = new UnresolvedType[bindings.length]; | ||||
for (int i = 0; i < paramTypes.length; i++) | for (int i = 0; i < paramTypes.length; i++) | ||||
paramTypes[i] = bindings[i].getType(); | paramTypes[i] = bindings[i].getType(); | ||||
ResolvedPointcutDefinition resPcutDef = new ResolvedPointcutDefinition(factory.fromBinding(((TypeDeclaration) typeStack | |||||
.peek()).binding), methodDeclaration.modifiers, "anonymous", paramTypes, pc); | |||||
ResolvedPointcutDefinition resPcutDef = new ResolvedPointcutDefinition(factory.fromBinding(typeStack.peek().binding), | |||||
methodDeclaration.modifiers, "anonymous", paramTypes, pc); | |||||
AjAttribute attr = new AjAttribute.PointcutDeclarationAttribute(resPcutDef); | AjAttribute attr = new AjAttribute.PointcutDeclarationAttribute(resPcutDef); | ||||
((AjMethodDeclaration) methodDeclaration).addAttribute(new EclipseAttributeAdapter(attr)); | ((AjMethodDeclaration) methodDeclaration).addAttribute(new EclipseAttributeAdapter(attr)); | ||||
} catch (ParserException pEx) { | } catch (ParserException pEx) { | ||||
} | } | ||||
private void convertToPointcutDeclaration(MethodDeclaration methodDeclaration, ClassScope scope) { | private void convertToPointcutDeclaration(MethodDeclaration methodDeclaration, ClassScope scope) { | ||||
TypeDeclaration typeDecl = (TypeDeclaration) typeStack.peek(); | |||||
TypeDeclaration typeDecl = typeStack.peek(); | |||||
if (typeDecl.binding != null) { | if (typeDecl.binding != null) { | ||||
if (!typeDecl.binding.isClass()) { | if (!typeDecl.binding.isClass()) { | ||||
methodDeclaration.scope.problemReporter().signalError(methodDeclaration.sourceStart, methodDeclaration.sourceEnd, | methodDeclaration.scope.problemReporter().signalError(methodDeclaration.sourceStart, methodDeclaration.sourceEnd, | ||||
} | } | ||||
pcDecl.pointcutDesignator = (pc == null) ? null : new PointcutDesignator(pc); | pcDecl.pointcutDesignator = (pc == null) ? null : new PointcutDesignator(pc); | ||||
pcDecl.setGenerateSyntheticPointcutMethod(); | pcDecl.setGenerateSyntheticPointcutMethod(); | ||||
TypeDeclaration onType = (TypeDeclaration) typeStack.peek(); | |||||
TypeDeclaration onType = typeStack.peek(); | |||||
pcDecl.postParse(onType); | pcDecl.postParse(onType); | ||||
// EclipseFactory factory = | // EclipseFactory factory = | ||||
// EclipseFactory.fromScopeLookupEnvironment | // EclipseFactory.fromScopeLookupEnvironment |
// Check if the type we are looking at is the topMostImplementor of a | // Check if the type we are looking at is the topMostImplementor of a | ||||
// dangerous interface - | // dangerous interface - | ||||
// report a problem if it is. | // report a problem if it is. | ||||
for (Object o : dangerousInterfaces.entrySet()) { | |||||
Map.Entry<ResolvedType, String> entry = (Map.Entry) o; | |||||
ResolvedType interfaceType = (ResolvedType) entry.getKey(); | |||||
for (Map.Entry<ResolvedType, String> entry : dangerousInterfaces.entrySet()) { | |||||
ResolvedType interfaceType = entry.getKey(); | |||||
if (onType.isTopmostImplementor(interfaceType)) { | if (onType.isTopmostImplementor(interfaceType)) { | ||||
factory.showMessage(IMessage.ERROR, onType + ": " + entry.getValue(), onType.getSourceLocation(), null); | factory.showMessage(IMessage.ERROR, onType + ": " + entry.getValue(), onType.getSourceLocation(), null); | ||||
} | } | ||||
if (pendingTypesToFinish.size() > 0) { | if (pendingTypesToFinish.size() > 0) { | ||||
processingTheQueue = true; | processingTheQueue = true; | ||||
while (!pendingTypesToFinish.isEmpty()) { | while (!pendingTypesToFinish.isEmpty()) { | ||||
BinaryTypeBinding nextVictim = (BinaryTypeBinding) pendingTypesToFinish.remove(0); | |||||
BinaryTypeBinding nextVictim = pendingTypesToFinish.remove(0); | |||||
// During this call we may recurse into this method and add | // During this call we may recurse into this method and add | ||||
// more entries to the pendingTypesToFinish list. | // more entries to the pendingTypesToFinish list. | ||||
weaveInterTypeDeclarations(nextVictim); | weaveInterTypeDeclarations(nextVictim); |
int len = m.size(); | int len = m.size(); | ||||
ResolvedMember[] ret = new ResolvedMember[len]; | ResolvedMember[] ret = new ResolvedMember[len]; | ||||
int index = 0; | int index = 0; | ||||
for (Object o : m) { | |||||
ret[index++] = (ResolvedMember) o; | |||||
for (ResolvedMember o : m) { | |||||
ret[index++] = o; | |||||
} | } | ||||
return ret; | return ret; | ||||
} | } |
Collection<ResolvedMember> privvies = ((ReferenceType) theAspect).getPrivilegedAccesses(); | Collection<ResolvedMember> privvies = ((ReferenceType) theAspect).getPrivilegedAccesses(); | ||||
// On an incremental compile the information is in the bcel delegate | // On an incremental compile the information is in the bcel delegate | ||||
if (privvies != null) { | if (privvies != null) { | ||||
for (Object privvy : privvies) { | |||||
ResolvedMember priv = (ResolvedMember) privvy; | |||||
for (ResolvedMember priv : privvies) { | |||||
if (priv.getName().equals(fname)) { | if (priv.getName().equals(fname)) { | ||||
return; | return; | ||||
} | } |
if (!outputDirsToAspects.containsKey(outputDir)) { | if (!outputDirsToAspects.containsKey(outputDir)) { | ||||
outputDirsToAspects.put(outputDir, new ArrayList<>()); | outputDirsToAspects.put(outputDir, new ArrayList<>()); | ||||
} | } | ||||
((List) outputDirsToAspects.get(outputDir)).add(aspectName); | |||||
outputDirsToAspects.get(outputDir).add(aspectName); | |||||
} | } | ||||
} | } | ||||
} | } |
// -- remove duplicates before adding (XXX use them instead?) | // -- remove duplicates before adding (XXX use them instead?) | ||||
if (addToNode != null && addToNode.getChildren() != null) { | if (addToNode != null && addToNode.getChildren() != null) { | ||||
for (ListIterator<IProgramElement> itt = addToNode.getChildren().listIterator(); itt.hasNext();) { | for (ListIterator<IProgramElement> itt = addToNode.getChildren().listIterator(); itt.hasNext();) { | ||||
IProgramElement child = (IProgramElement) itt.next(); | |||||
IProgramElement child = itt.next(); | |||||
ISourceLocation childLoc = child.getSourceLocation(); | ISourceLocation childLoc = child.getSourceLocation(); | ||||
if (null == childLoc) { | if (null == childLoc) { | ||||
// XXX ok, packages have null source locations | // XXX ok, packages have null source locations | ||||
peNode.setFormalComment(generateJavadocComment(memberTypeDeclaration)); | peNode.setFormalComment(generateJavadocComment(memberTypeDeclaration)); | ||||
peNode.setAnnotationStyleDeclaration(isAnnotationStyleAspect); | peNode.setAnnotationStyleDeclaration(isAnnotationStyleAspect); | ||||
((IProgramElement) stack.peek()).addChild(peNode); | |||||
stack.peek().addChild(peNode); | |||||
stack.push(peNode); | stack.push(peNode); | ||||
return true; | return true; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
IProgramElement ipe = (IProgramElement)stack.peek(); | |||||
IProgramElement ipe = stack.peek(); | |||||
if (ipe!=null) { | if (ipe!=null) { | ||||
// With AspectJ 1.8.9 the type structure must be slightly different as the guard | // With AspectJ 1.8.9 the type structure must be slightly different as the guard | ||||
// is required (the null is due to a default constructor). | // is required (the null is due to a default constructor). | ||||
((IProgramElement) stack.peek()).addChild(peNode); | |||||
stack.peek().addChild(peNode); | |||||
} | } | ||||
stack.push(peNode); | stack.push(peNode); | ||||
return true; | return true; | ||||
.equals("main(java.lang.String[])")) | .equals("main(java.lang.String[])")) | ||||
&& peNode.getModifiers().contains(IProgramElement.Modifiers.STATIC) | && peNode.getModifiers().contains(IProgramElement.Modifiers.STATIC) | ||||
&& peNode.getAccessibility().equals(IProgramElement.Accessibility.PUBLIC)) { | && peNode.getAccessibility().equals(IProgramElement.Accessibility.PUBLIC)) { | ||||
((IProgramElement) stack.peek()).setRunnable(true); | |||||
stack.peek().setRunnable(true); | |||||
} | } | ||||
} | } | ||||
npe.printStackTrace(); | npe.printStackTrace(); | ||||
} | } | ||||
} | } | ||||
((IProgramElement) stack.peek()).addChild(peNode); | |||||
stack.peek().addChild(peNode); | |||||
} | } | ||||
public void endVisit(MethodDeclaration methodDeclaration, ClassScope scope) { | public void endVisit(MethodDeclaration methodDeclaration, ClassScope scope) { | ||||
// create Source signature for import | // create Source signature for import | ||||
peNode.setSourceSignature(genSourceSignature(importRef)); | peNode.setSourceSignature(genSourceSignature(importRef)); | ||||
IProgramElement containingTypeElement = (IProgramElement) stack.peek(); | |||||
IProgramElement containingTypeElement = stack.peek(); | |||||
ProgramElement imports = getImportReferencesRoot(); | ProgramElement imports = getImportReferencesRoot(); | ||||
imports.addChild(0, peNode); | imports.addChild(0, peNode); | ||||
stack.push(peNode); | stack.push(peNode); | ||||
} | } | ||||
private ProgramElement getImportReferencesRoot() { | private ProgramElement getImportReferencesRoot() { | ||||
IProgramElement element = (IProgramElement) stack.peek(); | |||||
IProgramElement element = stack.peek(); | |||||
boolean hasPackageDeclaration = (element.getChildren().get(0)).getKind().isPackageDeclaration(); | boolean hasPackageDeclaration = (element.getChildren().get(0)).getKind().isPackageDeclaration(); | ||||
return (ProgramElement) element.getChildren().get(hasPackageDeclaration ? 1 : 0); | return (ProgramElement) element.getChildren().get(hasPackageDeclaration ? 1 : 0); | ||||
} | } | ||||
peNode.setFormalComment(generateJavadocComment(fieldDeclaration)); | peNode.setFormalComment(generateJavadocComment(fieldDeclaration)); | ||||
// peNode.setBytecodeSignature(new String(fieldDeclaration.binding.type.signature())); | // peNode.setBytecodeSignature(new String(fieldDeclaration.binding.type.signature())); | ||||
((IProgramElement) stack.peek()).addChild(peNode); | |||||
stack.peek().addChild(peNode); | |||||
stack.push(peNode); | stack.push(peNode); | ||||
return true; | return true; | ||||
} | } | ||||
peNode.setBytecodeSignature(memberBytecodeSignature); | peNode.setBytecodeSignature(memberBytecodeSignature); | ||||
} | } | ||||
((IProgramElement) stack.peek()).addChild(peNode); | |||||
stack.peek().addChild(peNode); | |||||
stack.push(peNode); | stack.push(peNode); | ||||
return true; | return true; | ||||
} | } | ||||
makeLocation(initializer), initializer.modifiers, null, null); | makeLocation(initializer), initializer.modifiers, null, null); | ||||
// "", | // "", | ||||
// new ArrayList()); | // new ArrayList()); | ||||
((IProgramElement) stack.peek()).addChild(peNode); | |||||
stack.peek().addChild(peNode); | |||||
stack.push(peNode); | stack.push(peNode); | ||||
initializer.block.traverse(this, scope); | initializer.block.traverse(this, scope); | ||||
stack.pop(); | stack.pop(); |
System.out.println("Name " + entry.getKey()); | System.out.println("Name " + entry.getKey()); | ||||
File f = new File("n:/temp/foo.ajstate"); | File f = new File("n:/temp/foo.ajstate"); | ||||
try { | try { | ||||
AjState state = (AjState) entry.getValue(); | |||||
AjState state = entry.getValue(); | |||||
CompressingDataOutputStream dos = new CompressingDataOutputStream(new FileOutputStream(f)); | CompressingDataOutputStream dos = new CompressingDataOutputStream(new FileOutputStream(f)); | ||||
state.write(dos); | state.write(dos); | ||||
dos.close(); | dos.close(); | ||||
} | } | ||||
public static AjState retrieveStateFor(String configFile) { | public static AjState retrieveStateFor(String configFile) { | ||||
return (AjState) incrementalStates.get(configFile); | |||||
return incrementalStates.get(configFile); | |||||
} | } | ||||
// now, managing changes to entries on a classpath | // now, managing changes to entries on a classpath | ||||
CompilationResultDestinationManager outputManager = ajbc.getCompilationResultDestinationManager(); | CompilationResultDestinationManager outputManager = ajbc.getCompilationResultDestinationManager(); | ||||
if (outputManager != null) { | if (outputManager != null) { | ||||
List<File> outputDirs = outputManager.getAllOutputLocations(); | List<File> outputDirs = outputManager.getAllOutputLocations(); | ||||
for (Object o : outputDirs) { | |||||
File dir = (File) o; | |||||
for (File dir : outputDirs) { | |||||
if (dir.equals(location)) { | if (dir.equals(location)) { | ||||
if (debugIncrementalStates) { | if (debugIncrementalStates) { | ||||
System.err.println("< findStateManagingOutputLocation(" + location + ") returning " + element); | System.err.println("< findStateManagingOutputLocation(" + location + ") returning " + element); |
setFromProperties(p); | setFromProperties(p); | ||||
} | } | ||||
@SuppressWarnings("rawtypes") | |||||
public void setFromProperties(Properties properties) { | public void setFromProperties(Properties properties) { | ||||
for (Map.Entry<Object, Object> objectObjectEntry : properties.entrySet()) { | |||||
Map.Entry entry = (Map.Entry) objectObjectEntry; | |||||
for (Map.Entry<Object, Object> entry : properties.entrySet()) { | |||||
Kind kind = kinds.get(entry.getKey()); | Kind kind = kinds.get(entry.getKey()); | ||||
if (kind == null) { | if (kind == null) { | ||||
MessageUtil.error(world.getMessageHandler(), WeaverMessages.format(WeaverMessages.XLINT_KEY_ERROR, entry.getKey())); | MessageUtil.error(world.getMessageHandler(), WeaverMessages.format(WeaverMessages.XLINT_KEY_ERROR, entry.getKey())); |
// If we are raw, we have a generic type - we should ensure it uses the | // If we are raw, we have a generic type - we should ensure it uses the | ||||
// same delegate | // same delegate | ||||
if (isRawType() && getGenericType() != null) { | if (isRawType() && getGenericType() != null) { | ||||
ReferenceType genType = (ReferenceType) getGenericType(); | |||||
ReferenceType genType = getGenericType(); | |||||
if (genType.getDelegate() != delegate) { // avoids circular updates | if (genType.getDelegate() != delegate) { // avoids circular updates | ||||
genType.setDelegate(delegate); | genType.setDelegate(delegate); | ||||
} | } |
} | } | ||||
public ClassLoader getClassLoader() { | public ClassLoader getClassLoader() { | ||||
ClassLoader instance = (ClassLoader) loaderRef.get(); | |||||
ClassLoader instance = loaderRef.get(); | |||||
// Assert instance!=null | // Assert instance!=null | ||||
return instance; | return instance; | ||||
} | } |
} | } | ||||
public AnnotationPatternList(List<AnnotationTypePattern> l) { | public AnnotationPatternList(List<AnnotationTypePattern> l) { | ||||
this((AnnotationTypePattern[]) l.toArray(AnnotationTypePattern.NONE)); | |||||
this(l.toArray(AnnotationTypePattern.NONE)); | |||||
} | } | ||||
protected AnnotationTypePattern[] getAnnotationPatterns() { | protected AnnotationTypePattern[] getAnnotationPatterns() { |
//System.out.println(tokens); | //System.out.println(tokens); | ||||
return new BasicTokenSource((IToken[])tokens.toArray(new IToken[0]), context); | |||||
return new BasicTokenSource(tokens.toArray(new IToken[0]), context); | |||||
} | } | ||||
private static String makeString(char ch) { | private static String makeString(char ch) { |
} | } | ||||
public Bindings copy() { | public Bindings copy() { | ||||
// int len = bindings.length; | |||||
// boolean[] a = new boolean[len]; | |||||
// System.arraycopy(bindings, 0, a, 0, len); | |||||
return new Bindings((BindingPattern[]) bindings.clone()); | |||||
return new Bindings(bindings.clone()); | |||||
} | } | ||||
public void checkAllBound(IScope scope) { | public void checkAllBound(IScope scope) { |
} | } | ||||
int[] indices = new int[slots.size()]; | int[] indices = new int[slots.size()]; | ||||
for (int i = 0; i < indices.length; i++) { | for (int i = 0; i < indices.length; i++) { | ||||
indices[i] = ((Slot) slots.get(i)).formalIndex; | |||||
indices[i] = slots.get(i).formalIndex; | |||||
} | } | ||||
return indices; | return indices; | ||||
} | } |
// TODO what about ITDs | // TODO what about ITDs | ||||
World world = type.getWorld(); | World world = type.getWorld(); | ||||
for (Iterator<ResolvedMember> iter = type.getFields(); iter.hasNext();) { | for (Iterator<ResolvedMember> iter = type.getFields(); iter.hasNext();) { | ||||
Member field = (Member) iter.next(); | |||||
Member field = iter.next(); | |||||
if (field.getName().startsWith(declareAtPrefix)) { | if (field.getName().startsWith(declareAtPrefix)) { | ||||
continue; | continue; | ||||
} | } | ||||
// TODO what about ITDs | // TODO what about ITDs | ||||
World world = type.getWorld(); | World world = type.getWorld(); | ||||
for (Iterator<ResolvedMember> iter = type.getMethods(true, true); iter.hasNext();) { | for (Iterator<ResolvedMember> iter = type.getMethods(true, true); iter.hasNext();) { | ||||
Member method = (Member) iter.next(); | |||||
Member method = iter.next(); | |||||
if (method.getName().startsWith(declareAtPrefix)) { | if (method.getName().startsWith(declareAtPrefix)) { | ||||
continue; | continue; | ||||
} | } |
if ((extraParameterFlags & Advice.ConstantValue) != 0) { | if ((extraParameterFlags & Advice.ConstantValue) != 0) { | ||||
return FuzzyBoolean.YES; | return FuzzyBoolean.YES; | ||||
} else { | } else { | ||||
return FuzzyBoolean.NO; | |||||
return FuzzyBoolean.NO; | |||||
} | } | ||||
} | } | ||||
} | } | ||||
args.add(shadow.getThisEnclosingJoinPointStaticPartVar()); | args.add(shadow.getThisEnclosingJoinPointStaticPartVar()); | ||||
} else { | } else { | ||||
if (state.size() == 0 || currentStateIndex > state.size()) { // if 'we have nothing else to bind from in the state object' | |||||
if (state.size() == 0 || currentStateIndex > state.size()) { // if 'we have nothing else to bind from in the state object' | |||||
String[] paramNames = testMethod.getParameterNames(); | String[] paramNames = testMethod.getParameterNames(); | ||||
StringBuilder errorParameter = new StringBuilder(); | StringBuilder errorParameter = new StringBuilder(); | ||||
// Support a single special situation: where the if() pointcut takes a parameter bound elsewhere | // Support a single special situation: where the if() pointcut takes a parameter bound elsewhere | ||||
// in the pointcut but the advice does not bind it. For example: | // in the pointcut but the advice does not bind it. For example: | ||||
// | // | ||||
continue; | continue; | ||||
} | } | ||||
} | } | ||||
if (paramNames != null) { | if (paramNames != null) { | ||||
errorParameter.append(testMethod.getParameterTypes()[i].getName()).append(" "); | errorParameter.append(testMethod.getParameterTypes()[i].getName()).append(" "); | ||||
errorParameter.append(paramNames[i]); | errorParameter.append(paramNames[i]); | ||||
} | } | ||||
} | } | ||||
ret = Test.makeAnd(ret, Test.makeCall(testMethod, (Expr[]) args.toArray(Expr.NONE))); | |||||
ret = Test.makeAnd(ret, Test.makeCall(testMethod, args.toArray(Expr.NONE))); | |||||
// Remember... | // Remember... | ||||
ifLastMatchedShadowId = shadow.shadowId; | ifLastMatchedShadowId = shadow.shadowId; | ||||
if (def != null) { | if (def != null) { | ||||
ResolvedType aspect = inAspect.getWorld().resolve(def.getDeclaringType()); | ResolvedType aspect = inAspect.getWorld().resolve(def.getDeclaringType()); | ||||
for (Iterator<ResolvedMember> memberIter = aspect.getMethods(true, true); memberIter.hasNext();) { | for (Iterator<ResolvedMember> memberIter = aspect.getMethods(true, true); memberIter.hasNext();) { | ||||
ResolvedMember method = (ResolvedMember) memberIter.next(); | |||||
ResolvedMember method = memberIter.next(); | |||||
if (def.getName().equals(method.getName()) | if (def.getName().equals(method.getName()) | ||||
&& def.getParameterTypes().length == method.getParameterTypes().length) { | && def.getParameterTypes().length == method.getParameterTypes().length) { | ||||
boolean sameSig = true; | boolean sameSig = true; |
ResolvedType myType = type.getExactType().resolve(world); | ResolvedType myType = type.getExactType().resolve(world); | ||||
if (myType.isParameterizedType()) { | if (myType.isParameterizedType()) { | ||||
// unchecked warning already issued... | // unchecked warning already issued... | ||||
myType = (ResolvedType) myType.getRawType(); | |||||
myType = myType.getRawType(); | |||||
} | } | ||||
return Test.makeInstanceof(var, myType.resolve(world)); | return Test.makeInstanceof(var, myType.resolve(world)); | ||||
} | } |
} | } | ||||
// FuzzyBoolean ret = FuzzyBoolean.NO; // ??? -eh | // FuzzyBoolean ret = FuzzyBoolean.NO; // ??? -eh | ||||
for (Iterator<ResolvedType> i = superType.getDirectSupertypes(); i.hasNext();) { | for (Iterator<ResolvedType> i = superType.getDirectSupertypes(); i.hasNext();) { | ||||
ResolvedType superSuperType = (ResolvedType) i.next(); | |||||
ResolvedType superSuperType = i.next(); | |||||
if (matchesSubtypes(superSuperType, annotatedType)) { | if (matchesSubtypes(superSuperType, annotatedType)) { | ||||
return true; | return true; | ||||
} | } |
} | } | ||||
public TypePatternList(List<TypePattern> l) { | public TypePatternList(List<TypePattern> l) { | ||||
this((TypePattern[]) l.toArray(new TypePattern[0])); | |||||
this(l.toArray(new TypePattern[0])); | |||||
} | } | ||||
public int size() { | public int size() { |
public Question anyChanges() { | public Question anyChanges() { | ||||
for (Map.Entry<Question, FuzzyBoolean> entry : questionsAndAnswers.entrySet()) { | for (Map.Entry<Question, FuzzyBoolean> entry : questionsAndAnswers.entrySet()) { | ||||
Question question = (Question) entry.getKey(); | |||||
FuzzyBoolean expectedAnswer = (FuzzyBoolean) entry.getValue(); | |||||
Question question = entry.getKey(); | |||||
FuzzyBoolean expectedAnswer = entry.getValue(); | |||||
FuzzyBoolean currentAnswer = question.ask(); | FuzzyBoolean currentAnswer = question.ask(); | ||||
//System.out.println(question + ":" + currentAnswer); | //System.out.println(question + ":" + currentAnswer); | ||||
StringBuilder buf = new StringBuilder(); | StringBuilder buf = new StringBuilder(); | ||||
buf.append("TypePatternQuestions{"); | buf.append("TypePatternQuestions{"); | ||||
for (Map.Entry<Question,FuzzyBoolean> entry: questionsAndAnswers.entrySet()) { | for (Map.Entry<Question,FuzzyBoolean> entry: questionsAndAnswers.entrySet()) { | ||||
Question question = (Question)entry.getKey(); | |||||
FuzzyBoolean expectedAnswer = (FuzzyBoolean)entry.getValue(); | |||||
Question question = entry.getKey(); | |||||
FuzzyBoolean expectedAnswer = entry.getValue(); | |||||
buf.append(question); | buf.append(question); | ||||
buf.append(":"); | buf.append(":"); | ||||
buf.append(expectedAnswer); | buf.append(expectedAnswer); |
} | } | ||||
public WildTypePattern(List<NamePattern> names, boolean includeSubtypes, int dim) { | public WildTypePattern(List<NamePattern> names, boolean includeSubtypes, int dim) { | ||||
this((NamePattern[]) names.toArray(new NamePattern[0]), includeSubtypes, dim, false, TypePatternList.EMPTY); | |||||
this(names.toArray(new NamePattern[0]), includeSubtypes, dim, false, TypePatternList.EMPTY); | |||||
} | } | ||||
public WildTypePattern(List<NamePattern> names, boolean includeSubtypes, int dim, int endPos, boolean isVarArg, TypePatternList typeParams, | public WildTypePattern(List<NamePattern> names, boolean includeSubtypes, int dim, int endPos, boolean isVarArg, TypePatternList typeParams, | ||||
TypePattern upperBound, TypePattern[] additionalInterfaceBounds, TypePattern lowerBound) { | TypePattern upperBound, TypePattern[] additionalInterfaceBounds, TypePattern lowerBound) { | ||||
this((NamePattern[]) names.toArray(new NamePattern[0]), includeSubtypes, dim, isVarArg, typeParams); | |||||
this(names.toArray(new NamePattern[0]), includeSubtypes, dim, isVarArg, typeParams); | |||||
this.end = endPos; | this.end = endPos; | ||||
this.upperBound = upperBound; | this.upperBound = upperBound; | ||||
this.lowerBound = lowerBound; | this.lowerBound = lowerBound; | ||||
} | } | ||||
public WildTypePattern(List<NamePattern> names, boolean includeSubtypes, int dim, int endPos, boolean isVarArg, TypePatternList typeParams) { | public WildTypePattern(List<NamePattern> names, boolean includeSubtypes, int dim, int endPos, boolean isVarArg, TypePatternList typeParams) { | ||||
this((NamePattern[]) names.toArray(new NamePattern[0]), includeSubtypes, dim, isVarArg, typeParams); | |||||
this(names.toArray(new NamePattern[0]), includeSubtypes, dim, isVarArg, typeParams); | |||||
this.end = endPos; | this.end = endPos; | ||||
} | } | ||||
Var v = ReflectionVar.createAtAnnotationVar(annType, this.annotationFinder); | Var v = ReflectionVar.createAtAnnotationVar(annType, this.annotationFinder); | ||||
annotationVar.put(annType, v); | annotationVar.put(annType, v); | ||||
} | } | ||||
return (Var) annotationVar.get(annType); | |||||
return annotationVar.get(annType); | |||||
} | } | ||||
/* | /* | ||||
Var v = ReflectionVar.createWithinAnnotationVar(annType, this.annotationFinder); | Var v = ReflectionVar.createWithinAnnotationVar(annType, this.annotationFinder); | ||||
withinAnnotationVar.put(annType, v); | withinAnnotationVar.put(annType, v); | ||||
} | } | ||||
return (Var) withinAnnotationVar.get(annType); | |||||
return withinAnnotationVar.get(annType); | |||||
} | } | ||||
/* | /* | ||||
Var v = ReflectionVar.createWithinCodeAnnotationVar(annType, this.annotationFinder); | Var v = ReflectionVar.createWithinCodeAnnotationVar(annType, this.annotationFinder); | ||||
withinCodeAnnotationVar.put(annType, v); | withinCodeAnnotationVar.put(annType, v); | ||||
} | } | ||||
return (Var) withinCodeAnnotationVar.get(annType); | |||||
return withinCodeAnnotationVar.get(annType); | |||||
} | } | ||||
/* | /* | ||||
Var[] vars = new Var[getArgCount()]; | Var[] vars = new Var[getArgCount()]; | ||||
atArgsVars.put(annType, vars); | atArgsVars.put(annType, vars); | ||||
} | } | ||||
Var[] vars = (Var[]) atArgsVars.get(annType); | |||||
Var[] vars = atArgsVars.get(annType); | |||||
if (i > (vars.length - 1)) | if (i > (vars.length - 1)) | ||||
return null; | return null; | ||||
if (vars[i] == null) { | if (vars[i] == null) { |
Var v = ReflectionVar.createAtAnnotationVar(annType, this.annotationFinder); | Var v = ReflectionVar.createAtAnnotationVar(annType, this.annotationFinder); | ||||
annotationVar.put(annType, v); | annotationVar.put(annType, v); | ||||
} | } | ||||
return (Var) annotationVar.get(annType); | |||||
return annotationVar.get(annType); | |||||
} | } | ||||
/* | /* | ||||
Var v = ReflectionVar.createWithinAnnotationVar(annType, this.annotationFinder); | Var v = ReflectionVar.createWithinAnnotationVar(annType, this.annotationFinder); | ||||
withinAnnotationVar.put(annType, v); | withinAnnotationVar.put(annType, v); | ||||
} | } | ||||
return (Var) withinAnnotationVar.get(annType); | |||||
return withinAnnotationVar.get(annType); | |||||
} | } | ||||
/* | /* | ||||
Var v = ReflectionVar.createWithinCodeAnnotationVar(annType, this.annotationFinder); | Var v = ReflectionVar.createWithinCodeAnnotationVar(annType, this.annotationFinder); | ||||
withinCodeAnnotationVar.put(annType, v); | withinCodeAnnotationVar.put(annType, v); | ||||
} | } | ||||
return (Var) withinCodeAnnotationVar.get(annType); | |||||
return withinCodeAnnotationVar.get(annType); | |||||
} | } | ||||
/* | /* | ||||
Var[] vars = new Var[getArgCount()]; | Var[] vars = new Var[getArgCount()]; | ||||
atArgsVars.put(annType, vars); | atArgsVars.put(annType, vars); | ||||
} | } | ||||
Var[] vars = (Var[]) atArgsVars.get(annType); | |||||
Var[] vars = atArgsVars.get(annType); | |||||
if (i > (vars.length - 1)) | if (i > (vars.length - 1)) | ||||
return null; | return null; | ||||
if (vars[i] == null) { | if (vars[i] == null) { |
*/ | */ | ||||
public AjType<? super T> getSupertype() { | public AjType<? super T> getSupertype() { | ||||
Class<? super T> superclass = clazz.getSuperclass(); | Class<? super T> superclass = clazz.getSuperclass(); | ||||
return superclass==null ? null : (AjType<? super T>) new AjTypeImpl<>(superclass); | |||||
return superclass==null ? null : new AjTypeImpl<>(superclass); | |||||
} | } | ||||
/* (non-Javadoc) | /* (non-Javadoc) |
public Object peek() { | public Object peek() { | ||||
Stack<?> stack = getThreadStack(); | Stack<?> stack = getThreadStack(); | ||||
if (stack.isEmpty()) throw new org.aspectj.lang.NoAspectBoundException(); | if (stack.isEmpty()) throw new org.aspectj.lang.NoAspectBoundException(); | ||||
return (Object)stack.peek(); | |||||
return stack.peek(); | |||||
} | } | ||||
public Object get(int index) { | public Object get(int index) { |
private synchronized Counter getThreadCounter() { | private synchronized Counter getThreadCounter() { | ||||
if (Thread.currentThread() != cached_thread) { | if (Thread.currentThread() != cached_thread) { | ||||
cached_thread = Thread.currentThread(); | cached_thread = Thread.currentThread(); | ||||
cached_counter = (Counter)counters.get(cached_thread); | |||||
cached_counter = counters.get(cached_thread); | |||||
if (cached_counter == null) { | if (cached_counter == null) { | ||||
cached_counter = new Counter(); | cached_counter = new Counter(); | ||||
counters.put(cached_thread, cached_counter); | counters.put(cached_thread, cached_counter); | ||||
if (change_count > Math.max(MIN_COLLECT_AT, COLLECT_AT/size)) { | if (change_count > Math.max(MIN_COLLECT_AT, COLLECT_AT/size)) { | ||||
List<Thread> dead_stacks = new ArrayList<>(); | List<Thread> dead_stacks = new ArrayList<>(); | ||||
for (Enumeration<Thread> e = counters.keys(); e.hasMoreElements(); ) { | for (Enumeration<Thread> e = counters.keys(); e.hasMoreElements(); ) { | ||||
Thread t = (Thread)e.nextElement(); | |||||
Thread t = e.nextElement(); | |||||
if (!t.isAlive()) dead_stacks.add(t); | if (!t.isAlive()) dead_stacks.add(t); | ||||
} | } | ||||
for (Thread t : dead_stacks) { | for (Thread t : dead_stacks) { |
return new Stack(); | return new Stack(); | ||||
} | } | ||||
public Stack getThreadStack() { | public Stack getThreadStack() { | ||||
return (Stack)get(); | |||||
return get(); | |||||
} | } | ||||
public void removeThreadStack() { | public void removeThreadStack() { | ||||
this.remove(); | this.remove(); | ||||
return new Counter(); | return new Counter(); | ||||
} | } | ||||
public Counter getThreadCounter() { | public Counter getThreadCounter() { | ||||
return (Counter)get(); | |||||
return get(); | |||||
} | } | ||||
public void removeThreadCounter() { | public void removeThreadCounter() { |
if (change_count > Math.max(MIN_COLLECT_AT, COLLECT_AT/size)) { | if (change_count > Math.max(MIN_COLLECT_AT, COLLECT_AT/size)) { | ||||
Stack<Thread> dead_stacks = new Stack<>(); | Stack<Thread> dead_stacks = new Stack<>(); | ||||
for (Enumeration<Thread> e = stacks.keys(); e.hasMoreElements(); ) { | for (Enumeration<Thread> e = stacks.keys(); e.hasMoreElements(); ) { | ||||
Thread t = (Thread)e.nextElement(); | |||||
Thread t = e.nextElement(); | |||||
if (!t.isAlive()) dead_stacks.push(t); | if (!t.isAlive()) dead_stacks.push(t); | ||||
} | } | ||||
for (Enumeration<Thread> e = dead_stacks.elements(); e.hasMoreElements(); ) { | for (Enumeration<Thread> e = dead_stacks.elements(); e.hasMoreElements(); ) { | ||||
Thread t = (Thread)e.nextElement(); | |||||
Thread t = e.nextElement(); | |||||
stacks.remove(t); | stacks.remove(t); | ||||
} | } | ||||
change_count = 0; | change_count = 0; |
static Class<?> makeClass(String s, ClassLoader loader) { | static Class<?> makeClass(String s, ClassLoader loader) { | ||||
if (s.equals("*")) | if (s.equals("*")) | ||||
return null; | return null; | ||||
Class<?> ret = (Class)prims.get(s); | |||||
Class<?> ret = prims.get(s); | |||||
if (ret != null) | if (ret != null) | ||||
return ret; | return ret; | ||||
try { | try { |
} | } | ||||
private String[] array() { | private String[] array() { | ||||
return (String[]) toStringCacheRef.get(); | |||||
return toStringCacheRef.get(); | |||||
} | } | ||||
private String[] makeCache() { | private String[] makeCache() { |
ArrayList<String> result = new ArrayList(cmd.extractArguments()); | ArrayList<String> result = new ArrayList(cmd.extractArguments()); | ||||
addListArgs(result); | addListArgs(result); | ||||
String[] command = (String[]) result.toArray(new String[0]); | |||||
String[] command = result.toArray(new String[0]); | |||||
if (null != commandEditor) { | if (null != commandEditor) { | ||||
command = commandEditor.editCommand(command); | command = commandEditor.editCommand(command); | ||||
} else if (null != COMMAND_EDITOR) { | } else if (null != COMMAND_EDITOR) { |
Enumeration<FileSet> e = fileSets.elements(); | Enumeration<FileSet> e = fileSets.elements(); | ||||
while (e.hasMoreElements()) { | while (e.hasMoreElements()) { | ||||
FileSet fs = (FileSet) e.nextElement(); | |||||
FileSet fs = e.nextElement(); | |||||
if (!fs.hasPatterns() && !fs.hasSelectors()) { | if (!fs.hasPatterns() && !fs.hasSelectors()) { | ||||
fs = (FileSet) fs.clone(); | fs = (FileSet) fs.clone(); | ||||
fs.createInclude().setName("**/*.java"); | fs.createInclude().setName("**/*.java"); |
argsList.add(args[i]); | argsList.add(args[i]); | ||||
} | } | ||||
} | } | ||||
return (String[])argsList.toArray(new String[0]); | |||||
return argsList.toArray(new String[0]); | |||||
} | } | ||||
/** | /** |
// not URL, zip, or dir - unsure what to do | // not URL, zip, or dir - unsure what to do | ||||
} | } | ||||
} | } | ||||
File[] dirRa = (File[]) dirs.toArray(new File[0]); | |||||
File[] libRa = (File[]) libs.toArray(new File[0]); | |||||
URL[] urlRa = (URL[]) urls.toArray(new URL[0]); | |||||
File[] dirRa = dirs.toArray(new File[0]); | |||||
File[] libRa = libs.toArray(new File[0]); | |||||
URL[] urlRa = urls.toArray(new URL[0]); | |||||
runMainInSameVM(urlRa, libRa, dirRa, className, args); | runMainInSameVM(urlRa, libRa, dirRa, className, args); | ||||
} | } | ||||
ShadowRange oldRange = (ShadowRange) old; | ShadowRange oldRange = (ShadowRange) old; | ||||
if (oldRange.getStart() == src) { | if (oldRange.getStart() == src) { | ||||
BcelShadow oldShadow = oldRange.getShadow(); | BcelShadow oldShadow = oldRange.getShadow(); | ||||
BcelShadow freshEnclosing = oldShadow.getEnclosingShadow() == null ? null : (BcelShadow) shadowMap | |||||
BcelShadow freshEnclosing = oldShadow.getEnclosingShadow() == null ? null : shadowMap | |||||
.get(oldShadow.getEnclosingShadow()); | .get(oldShadow.getEnclosingShadow()); | ||||
BcelShadow freshShadow = oldShadow.copyInto(recipient, freshEnclosing); | BcelShadow freshShadow = oldShadow.copyInto(recipient, freshEnclosing); | ||||
ShadowRange freshRange = new ShadowRange(recipient.getBody()); | ShadowRange freshRange = new ShadowRange(recipient.getBody()); |
} | } | ||||
if (isGeneric()) { | if (isGeneric()) { | ||||
// update resolved typex to point at generic type not raw type. | // update resolved typex to point at generic type not raw type. | ||||
ReferenceType genericType = (ReferenceType) this.resolvedTypeX.getGenericType(); | |||||
ReferenceType genericType = this.resolvedTypeX.getGenericType(); | |||||
// genericType.setSourceContext(this.resolvedTypeX.getSourceContext()); | // genericType.setSourceContext(this.resolvedTypeX.getSourceContext()); | ||||
// Can be null if unpacking whilst building the bcel delegate (in call hierarchy from BcelWorld.addSourceObjectType() | // Can be null if unpacking whilst building the bcel delegate (in call hierarchy from BcelWorld.addSourceObjectType() | ||||
// line 453) - see 317139 | // line 453) - see 317139 |
Enumeration<JarEntry> entries = inJar.entries(); | Enumeration<JarEntry> entries = inJar.entries(); | ||||
while (entries.hasMoreElements()) { | while (entries.hasMoreElements()) { | ||||
JarEntry entry = (JarEntry) entries.nextElement(); | |||||
JarEntry entry = entries.nextElement(); | |||||
InputStream inStream = inJar.getInputStream(entry); | InputStream inStream = inJar.getInputStream(entry); | ||||
byte[] bytes = FileUtil.readAsByteArray(inStream); | byte[] bytes = FileUtil.readAsByteArray(inStream); |
} | } | ||||
buf.append(c); | buf.append(c); | ||||
} else { | } else { | ||||
char[] value = (char[]) entities.get(key); | |||||
char[] value = entities.get(key); | |||||
if (value == null) { | if (value == null) { | ||||
throw new Exception("Unknown entity: " + key); | throw new Exception("Unknown entity: " + key); | ||||
} | } |
typeCompletionInProgress = false; | typeCompletionInProgress = false; | ||||
} | } | ||||
while (typesForCompletion.size() != 0) { | while (typesForCompletion.size() != 0) { | ||||
ResolvedType rt = (ResolvedType) typesForCompletion.get(0); | |||||
ResolvedType rt = typesForCompletion.get(0); | |||||
completeHierarchyForType(rt); | completeHierarchyForType(rt); | ||||
typesForCompletion.remove(0); | typesForCompletion.remove(0); | ||||
} | } |