panel.add(label,BorderLayout.WEST);
JComboBox warnings = new JComboBox(ignoreOrWarning);
- String value = (String) javaBuildOptions.getJavaBuildOptionsMap().get(javaOptionToSet);
+ String value = javaBuildOptions.getJavaBuildOptionsMap().get(javaOptionToSet);
if (value.equals(JavaOptions.IGNORE)) {
warnings.setSelectedIndex(0);
} else {
characterEncoding.setPreferredSize(new Dimension(150, 21));
panel.add(characterEncoding,BorderLayout.EAST);
- String option = (String) javaBuildOptions.getJavaBuildOptionsMap().get(
+ String option = javaBuildOptions.getJavaBuildOptionsMap().get(
JavaOptions.CHARACTER_ENCODING);
if (option != null) {
characterEncoding.setText(option);
public static String getPackageDeclarationFromFile(AsmManager model, File file) {
IProgramElement fileNode = model.getHierarchy().findElementForSourceFile(file.getAbsolutePath());
- String packageName = ((IProgramElement) fileNode.getChildren().get(0)).getPackageName();
+ String packageName = fileNode.getChildren().get(0).getPackageName();
return packageName;
}
for (int i = 0; i < node.getParameterTypes().size(); i++) {
sb.append(String.valueOf(node.getParameterTypes().get(i)));
sb.append(' ');
- sb.append((String) node.getParameterNames().get(i));
+ sb.append(node.getParameterNames().get(i));
if (i < node.getParameterTypes().size() - 1) {
sb.append(", ");
}
* @param max_gap maximum gap that may between case branches
*/
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==0) {
if (null == name) {
return null;
}
- Module result = (Module) modules.get(name);
+ Module result = modules.get(name);
if (null == result) {
File moduleDir = new File(baseDir, name);
if (!Util.canReadDir(moduleDir)) {
if (parser.classpath == null) {
addClasspath(System.getProperty("java.class.path", ""), ret);
List<String> fixedList = new ArrayList<>();
- for (Object o : ret) {
- String entry = (String) o;
+ for (String entry : ret) {
if (!entry.endsWith("aspectjtools.jar")) {
fixedList.add(entry);
}
private List<InterimCompilationResult> getBinarySourcesFrom(Map<String, List<UnwovenClassFile>> binarySourceEntries) {
// Map is fileName |-> List<UnwovenClassFile>
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);
// 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);
}
private void notifyRequestor() {
- for (Object o : resultsPendingWeave) {
- InterimCompilationResult iresult = (InterimCompilationResult) o;
+ for (InterimCompilationResult iresult : resultsPendingWeave) {
compiler.requestor.acceptResult(iresult.result().tagAsAccepted());
}
}
private void weave() throws IOException {
// 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++) {
weaver.addClassFile(iresult.unwovenClassFiles()[i], false);
}
if (nowProcessing == null) {
if (!resultIterator.hasNext())
return false;
- nowProcessing = (InterimCompilationResult) resultIterator.next();
+ nowProcessing = resultIterator.next();
classFileIndex = 0;
}
while (nowProcessing.unwovenClassFiles().length == 0) {
if (!resultIterator.hasNext())
return false;
- nowProcessing = (InterimCompilationResult) resultIterator.next();
+ nowProcessing = resultIterator.next();
}
if (classFileIndex < nowProcessing.unwovenClassFiles().length) {
return true;
classFileIndex = 0;
if (!resultIterator.hasNext())
return false;
- nowProcessing = (InterimCompilationResult) resultIterator.next();
+ nowProcessing = resultIterator.next();
while (nowProcessing.unwovenClassFiles().length == 0) {
if (!resultIterator.hasNext())
return false;
- nowProcessing = (InterimCompilationResult) resultIterator.next();
+ nowProcessing = resultIterator.next();
}
}
return true;
boolean usedBinarySourceFileName) {
List<IProblem> ret = new ArrayList<>();
- for (Object sourceLocation : sourceLocations) {
- ISourceLocation loc = (ISourceLocation) sourceLocation;
+ for (ISourceLocation loc : sourceLocations) {
if (loc != null) {
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, 0, 0, 0, 0);
ret.add(dp);
}
- IProblem[] retValue = (IProblem[]) ret.toArray(new IProblem[] {});
+ IProblem[] retValue = ret.toArray(new IProblem[] {});
return retValue;
}
ResolvedMember m = world.makeResolvedMember(binding);
ResolvedMember superAccessMember = AjcMemberMaker.superAccessMethod(inAspect.typeX, m);
if (inAspect.superAccessForInline.containsKey(superAccessMember)) {
- return ((SuperAccessMethodPair) inAspect.superAccessForInline.get(superAccessMember)).accessMethod;
+ return inAspect.superAccessForInline.get(superAccessMember).accessMethod;
}
MethodBinding ret = world.makeMethodBinding(superAccessMember);
inAspect.superAccessForInline.put(superAccessMember, new SuperAccessMethodPair(m, ret));
Collection<UnresolvedType> parentPatterns = dp.getParents().getExactTypes();
StringBuilder parents = new StringBuilder();
for (Iterator<UnresolvedType> iter = parentPatterns.iterator(); iter.hasNext();) {
- UnresolvedType urt = ((UnresolvedType) iter.next());
+ UnresolvedType urt = iter.next();
parents.append(urt.getName());
if (iter.hasNext()) {
parents.append(", ");
private boolean insideAspect() {
if (typeStack.empty())
return false;
- TypeDeclaration typeDecl = (TypeDeclaration) typeStack.peek();
+ TypeDeclaration typeDecl = typeStack.peek();
return isAspect(typeDecl);
}
UnresolvedType[] paramTypes = new UnresolvedType[bindings.length];
for (int i = 0; i < paramTypes.length; i++)
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);
((AjMethodDeclaration) methodDeclaration).addAttribute(new EclipseAttributeAdapter(attr));
} catch (ParserException pEx) {
}
private void convertToPointcutDeclaration(MethodDeclaration methodDeclaration, ClassScope scope) {
- TypeDeclaration typeDecl = (TypeDeclaration) typeStack.peek();
+ TypeDeclaration typeDecl = typeStack.peek();
if (typeDecl.binding != null) {
if (!typeDecl.binding.isClass()) {
methodDeclaration.scope.problemReporter().signalError(methodDeclaration.sourceStart, methodDeclaration.sourceEnd,
}
pcDecl.pointcutDesignator = (pc == null) ? null : new PointcutDesignator(pc);
pcDecl.setGenerateSyntheticPointcutMethod();
- TypeDeclaration onType = (TypeDeclaration) typeStack.peek();
+ TypeDeclaration onType = typeStack.peek();
pcDecl.postParse(onType);
// EclipseFactory factory =
// EclipseFactory.fromScopeLookupEnvironment
// Check if the type we are looking at is the topMostImplementor of a
// dangerous interface -
// 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)) {
factory.showMessage(IMessage.ERROR, onType + ": " + entry.getValue(), onType.getSourceLocation(), null);
}
if (pendingTypesToFinish.size() > 0) {
processingTheQueue = true;
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
// more entries to the pendingTypesToFinish list.
weaveInterTypeDeclarations(nextVictim);
int len = m.size();
ResolvedMember[] ret = new ResolvedMember[len];
int index = 0;
- for (Object o : m) {
- ret[index++] = (ResolvedMember) o;
+ for (ResolvedMember o : m) {
+ ret[index++] = o;
}
return ret;
}
Collection<ResolvedMember> privvies = ((ReferenceType) theAspect).getPrivilegedAccesses();
// On an incremental compile the information is in the bcel delegate
if (privvies != null) {
- for (Object privvy : privvies) {
- ResolvedMember priv = (ResolvedMember) privvy;
+ for (ResolvedMember priv : privvies) {
if (priv.getName().equals(fname)) {
return;
}
if (!outputDirsToAspects.containsKey(outputDir)) {
outputDirsToAspects.put(outputDir, new ArrayList<>());
}
- ((List) outputDirsToAspects.get(outputDir)).add(aspectName);
+ outputDirsToAspects.get(outputDir).add(aspectName);
}
}
}
// -- remove duplicates before adding (XXX use them instead?)
if (addToNode != null && addToNode.getChildren() != null) {
for (ListIterator<IProgramElement> itt = addToNode.getChildren().listIterator(); itt.hasNext();) {
- IProgramElement child = (IProgramElement) itt.next();
+ IProgramElement child = itt.next();
ISourceLocation childLoc = child.getSourceLocation();
if (null == childLoc) {
// XXX ok, packages have null source locations
peNode.setFormalComment(generateJavadocComment(memberTypeDeclaration));
peNode.setAnnotationStyleDeclaration(isAnnotationStyleAspect);
- ((IProgramElement) stack.peek()).addChild(peNode);
+ stack.peek().addChild(peNode);
stack.push(peNode);
return true;
}
}
}
- IProgramElement ipe = (IProgramElement)stack.peek();
+ IProgramElement ipe = stack.peek();
if (ipe!=null) {
// 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).
- ((IProgramElement) stack.peek()).addChild(peNode);
+ stack.peek().addChild(peNode);
}
stack.push(peNode);
return true;
.equals("main(java.lang.String[])"))
&& peNode.getModifiers().contains(IProgramElement.Modifiers.STATIC)
&& peNode.getAccessibility().equals(IProgramElement.Accessibility.PUBLIC)) {
- ((IProgramElement) stack.peek()).setRunnable(true);
+ stack.peek().setRunnable(true);
}
}
npe.printStackTrace();
}
}
- ((IProgramElement) stack.peek()).addChild(peNode);
+ stack.peek().addChild(peNode);
}
public void endVisit(MethodDeclaration methodDeclaration, ClassScope scope) {
// create Source signature for import
peNode.setSourceSignature(genSourceSignature(importRef));
- IProgramElement containingTypeElement = (IProgramElement) stack.peek();
+ IProgramElement containingTypeElement = stack.peek();
ProgramElement imports = getImportReferencesRoot();
imports.addChild(0, peNode);
stack.push(peNode);
}
private ProgramElement getImportReferencesRoot() {
- IProgramElement element = (IProgramElement) stack.peek();
+ IProgramElement element = stack.peek();
boolean hasPackageDeclaration = (element.getChildren().get(0)).getKind().isPackageDeclaration();
return (ProgramElement) element.getChildren().get(hasPackageDeclaration ? 1 : 0);
}
peNode.setFormalComment(generateJavadocComment(fieldDeclaration));
// peNode.setBytecodeSignature(new String(fieldDeclaration.binding.type.signature()));
- ((IProgramElement) stack.peek()).addChild(peNode);
+ stack.peek().addChild(peNode);
stack.push(peNode);
return true;
}
peNode.setBytecodeSignature(memberBytecodeSignature);
}
- ((IProgramElement) stack.peek()).addChild(peNode);
+ stack.peek().addChild(peNode);
stack.push(peNode);
return true;
}
makeLocation(initializer), initializer.modifiers, null, null);
// "",
// new ArrayList());
- ((IProgramElement) stack.peek()).addChild(peNode);
+ stack.peek().addChild(peNode);
stack.push(peNode);
initializer.block.traverse(this, scope);
stack.pop();
System.out.println("Name " + entry.getKey());
File f = new File("n:/temp/foo.ajstate");
try {
- AjState state = (AjState) entry.getValue();
+ AjState state = entry.getValue();
CompressingDataOutputStream dos = new CompressingDataOutputStream(new FileOutputStream(f));
state.write(dos);
dos.close();
}
public static AjState retrieveStateFor(String configFile) {
- return (AjState) incrementalStates.get(configFile);
+ return incrementalStates.get(configFile);
}
// now, managing changes to entries on a classpath
CompilationResultDestinationManager outputManager = ajbc.getCompilationResultDestinationManager();
if (outputManager != null) {
List<File> outputDirs = outputManager.getAllOutputLocations();
- for (Object o : outputDirs) {
- File dir = (File) o;
+ for (File dir : outputDirs) {
if (dir.equals(location)) {
if (debugIncrementalStates) {
System.err.println("< findStateManagingOutputLocation(" + location + ") returning " + element);
setFromProperties(p);
}
- @SuppressWarnings("rawtypes")
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());
if (kind == null) {
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
// same delegate
if (isRawType() && getGenericType() != null) {
- ReferenceType genType = (ReferenceType) getGenericType();
+ ReferenceType genType = getGenericType();
if (genType.getDelegate() != delegate) { // avoids circular updates
genType.setDelegate(delegate);
}
}
public ClassLoader getClassLoader() {
- ClassLoader instance = (ClassLoader) loaderRef.get();
+ ClassLoader instance = loaderRef.get();
// Assert instance!=null
return instance;
}
}
public AnnotationPatternList(List<AnnotationTypePattern> l) {
- this((AnnotationTypePattern[]) l.toArray(AnnotationTypePattern.NONE));
+ this(l.toArray(AnnotationTypePattern.NONE));
}
protected AnnotationTypePattern[] getAnnotationPatterns() {
//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) {
}
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) {
}
int[] indices = new int[slots.size()];
for (int i = 0; i < indices.length; i++) {
- indices[i] = ((Slot) slots.get(i)).formalIndex;
+ indices[i] = slots.get(i).formalIndex;
}
return indices;
}
// TODO what about ITDs
World world = type.getWorld();
for (Iterator<ResolvedMember> iter = type.getFields(); iter.hasNext();) {
- Member field = (Member) iter.next();
+ Member field = iter.next();
if (field.getName().startsWith(declareAtPrefix)) {
continue;
}
// TODO what about ITDs
World world = type.getWorld();
for (Iterator<ResolvedMember> iter = type.getMethods(true, true); iter.hasNext();) {
- Member method = (Member) iter.next();
+ Member method = iter.next();
if (method.getName().startsWith(declareAtPrefix)) {
continue;
}
if ((extraParameterFlags & Advice.ConstantValue) != 0) {
return FuzzyBoolean.YES;
} else {
- return FuzzyBoolean.NO;
+ return FuzzyBoolean.NO;
}
}
}
args.add(shadow.getThisEnclosingJoinPointStaticPartVar());
} 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();
StringBuilder errorParameter = new StringBuilder();
-
+
// 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:
//
continue;
}
}
-
+
if (paramNames != null) {
errorParameter.append(testMethod.getParameterTypes()[i].getName()).append(" ");
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...
ifLastMatchedShadowId = shadow.shadowId;
if (def != null) {
ResolvedType aspect = inAspect.getWorld().resolve(def.getDeclaringType());
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())
&& def.getParameterTypes().length == method.getParameterTypes().length) {
boolean sameSig = true;
ResolvedType myType = type.getExactType().resolve(world);
if (myType.isParameterizedType()) {
// unchecked warning already issued...
- myType = (ResolvedType) myType.getRawType();
+ myType = myType.getRawType();
}
return Test.makeInstanceof(var, myType.resolve(world));
}
}
// FuzzyBoolean ret = FuzzyBoolean.NO; // ??? -eh
for (Iterator<ResolvedType> i = superType.getDirectSupertypes(); i.hasNext();) {
- ResolvedType superSuperType = (ResolvedType) i.next();
+ ResolvedType superSuperType = i.next();
if (matchesSubtypes(superSuperType, annotatedType)) {
return true;
}
}
public TypePatternList(List<TypePattern> l) {
- this((TypePattern[]) l.toArray(new TypePattern[0]));
+ this(l.toArray(new TypePattern[0]));
}
public int size() {
public Question anyChanges() {
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();
//System.out.println(question + ":" + currentAnswer);
StringBuilder buf = new StringBuilder();
buf.append("TypePatternQuestions{");
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(":");
buf.append(expectedAnswer);
}
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,
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.upperBound = upperBound;
this.lowerBound = lowerBound;
}
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;
}
Var v = ReflectionVar.createAtAnnotationVar(annType, this.annotationFinder);
annotationVar.put(annType, v);
}
- return (Var) annotationVar.get(annType);
+ return annotationVar.get(annType);
}
/*
Var v = ReflectionVar.createWithinAnnotationVar(annType, this.annotationFinder);
withinAnnotationVar.put(annType, v);
}
- return (Var) withinAnnotationVar.get(annType);
+ return withinAnnotationVar.get(annType);
}
/*
Var v = ReflectionVar.createWithinCodeAnnotationVar(annType, this.annotationFinder);
withinCodeAnnotationVar.put(annType, v);
}
- return (Var) withinCodeAnnotationVar.get(annType);
+ return withinCodeAnnotationVar.get(annType);
}
/*
Var[] vars = new Var[getArgCount()];
atArgsVars.put(annType, vars);
}
- Var[] vars = (Var[]) atArgsVars.get(annType);
+ Var[] vars = atArgsVars.get(annType);
if (i > (vars.length - 1))
return null;
if (vars[i] == null) {
Var v = ReflectionVar.createAtAnnotationVar(annType, this.annotationFinder);
annotationVar.put(annType, v);
}
- return (Var) annotationVar.get(annType);
+ return annotationVar.get(annType);
}
/*
Var v = ReflectionVar.createWithinAnnotationVar(annType, this.annotationFinder);
withinAnnotationVar.put(annType, v);
}
- return (Var) withinAnnotationVar.get(annType);
+ return withinAnnotationVar.get(annType);
}
/*
Var v = ReflectionVar.createWithinCodeAnnotationVar(annType, this.annotationFinder);
withinCodeAnnotationVar.put(annType, v);
}
- return (Var) withinCodeAnnotationVar.get(annType);
+ return withinCodeAnnotationVar.get(annType);
}
/*
Var[] vars = new Var[getArgCount()];
atArgsVars.put(annType, vars);
}
- Var[] vars = (Var[]) atArgsVars.get(annType);
+ Var[] vars = atArgsVars.get(annType);
if (i > (vars.length - 1))
return null;
if (vars[i] == null) {
*/
public AjType<? super T> getSupertype() {
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)
public Object peek() {
Stack<?> stack = getThreadStack();
if (stack.isEmpty()) throw new org.aspectj.lang.NoAspectBoundException();
- return (Object)stack.peek();
+ return stack.peek();
}
public Object get(int index) {
private synchronized Counter getThreadCounter() {
if (Thread.currentThread() != cached_thread) {
cached_thread = Thread.currentThread();
- cached_counter = (Counter)counters.get(cached_thread);
+ cached_counter = counters.get(cached_thread);
if (cached_counter == null) {
cached_counter = new Counter();
counters.put(cached_thread, cached_counter);
if (change_count > Math.max(MIN_COLLECT_AT, COLLECT_AT/size)) {
List<Thread> dead_stacks = new ArrayList<>();
for (Enumeration<Thread> e = counters.keys(); e.hasMoreElements(); ) {
- Thread t = (Thread)e.nextElement();
+ Thread t = e.nextElement();
if (!t.isAlive()) dead_stacks.add(t);
}
for (Thread t : dead_stacks) {
return new Stack();
}
public Stack getThreadStack() {
- return (Stack)get();
+ return get();
}
public void removeThreadStack() {
this.remove();
return new Counter();
}
public Counter getThreadCounter() {
- return (Counter)get();
+ return get();
}
public void removeThreadCounter() {
if (change_count > Math.max(MIN_COLLECT_AT, COLLECT_AT/size)) {
Stack<Thread> dead_stacks = new Stack<>();
for (Enumeration<Thread> e = stacks.keys(); e.hasMoreElements(); ) {
- Thread t = (Thread)e.nextElement();
+ Thread t = e.nextElement();
if (!t.isAlive()) dead_stacks.push(t);
}
for (Enumeration<Thread> e = dead_stacks.elements(); e.hasMoreElements(); ) {
- Thread t = (Thread)e.nextElement();
+ Thread t = e.nextElement();
stacks.remove(t);
}
change_count = 0;
static Class<?> makeClass(String s, ClassLoader loader) {
if (s.equals("*"))
return null;
- Class<?> ret = (Class)prims.get(s);
+ Class<?> ret = prims.get(s);
if (ret != null)
return ret;
try {
}
private String[] array() {
- return (String[]) toStringCacheRef.get();
+ return toStringCacheRef.get();
}
private String[] makeCache() {
ArrayList<String> result = new ArrayList(cmd.extractArguments());
addListArgs(result);
- String[] command = (String[]) result.toArray(new String[0]);
+ String[] command = result.toArray(new String[0]);
if (null != commandEditor) {
command = commandEditor.editCommand(command);
} else if (null != COMMAND_EDITOR) {
Enumeration<FileSet> e = fileSets.elements();
while (e.hasMoreElements()) {
- FileSet fs = (FileSet) e.nextElement();
+ FileSet fs = e.nextElement();
if (!fs.hasPatterns() && !fs.hasSelectors()) {
fs = (FileSet) fs.clone();
fs.createInclude().setName("**/*.java");
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
}
}
- 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);
}
ShadowRange oldRange = (ShadowRange) old;
if (oldRange.getStart() == src) {
BcelShadow oldShadow = oldRange.getShadow();
- BcelShadow freshEnclosing = oldShadow.getEnclosingShadow() == null ? null : (BcelShadow) shadowMap
+ BcelShadow freshEnclosing = oldShadow.getEnclosingShadow() == null ? null : shadowMap
.get(oldShadow.getEnclosingShadow());
BcelShadow freshShadow = oldShadow.copyInto(recipient, freshEnclosing);
ShadowRange freshRange = new ShadowRange(recipient.getBody());
}
if (isGeneric()) {
// 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());
// Can be null if unpacking whilst building the bcel delegate (in call hierarchy from BcelWorld.addSourceObjectType()
// line 453) - see 317139
Enumeration<JarEntry> entries = inJar.entries();
while (entries.hasMoreElements()) {
- JarEntry entry = (JarEntry) entries.nextElement();
+ JarEntry entry = entries.nextElement();
InputStream inStream = inJar.getInputStream(entry);
byte[] bytes = FileUtil.readAsByteArray(inStream);
}
buf.append(c);
} else {
- char[] value = (char[]) entities.get(key);
+ char[] value = entities.get(key);
if (value == null) {
throw new Exception("Unknown entity: " + key);
}
typeCompletionInProgress = false;
}
while (typesForCompletion.size() != 0) {
- ResolvedType rt = (ResolvedType) typesForCompletion.get(0);
+ ResolvedType rt = typesForCompletion.get(0);
completeHierarchyForType(rt);
typesForCompletion.remove(0);
}