public AspectJTypeFilter(String typePatternExpression, @Nullable ClassLoader classLoader) { this.world = new BcelWorld(classLoader, IMessageHandler.THROW, null); this.world.setBehaveInJava5Way(true); PatternParser patternParser = new PatternParser(typePatternExpression); TypePattern typePattern = patternParser.parseTypePattern(); typePattern.resolve(this.world); IScope scope = new SimpleScope(this.world, new FormalBinding[0]); this.typePattern = typePattern.resolveBindings(scope, Bindings.NONE, false, false); }
perRequestScope = new SimpleScope(); Injector injector = Guice.createInjector(new AbstractModule() perRequestScope.enter(); perRequestScope.seed(Foo.class, makeFoo(requestData)); perRequestScope.seed(Bar.class, makeBar(requestData)); return theGuiceCreatedObject.get().doTheActualRequestLogic(requestData); } finally { perRequestScope.exit();
SimpleScope ss = new SimpleScope(getWorld(), formalBindings); ss.setImportedPrefixes(new String[] { "java.lang.", "java.util." }); return ss; } else {
public void message(IMessage.Kind kind, IHasPosition location, String message) { getMessageHandler().handleMessage(new Message(message, kind, null, makeSourceLocation(location))); }
public void message(IMessage aMessage) { getMessageHandler().handleMessage(aMessage); }
public UnresolvedType lookupType(String name, IHasPosition location) { // bug 126560 if (enclosingType != null && !importsUpdated) { // add the package we're in to the list of imported // prefixes so that we can find types in the same package String pkgName = enclosingType.getPackageName(); if (pkgName != null && !pkgName.equals("")) { String[] existingImports = getImportedPrefixes(); String pkgNameWithDot = pkgName.concat("."); boolean found = false; for (String existingImport : existingImports) { if (existingImport.equals(pkgNameWithDot)) { found = true; break; } } if (!found) { String[] newImports = new String[existingImports.length + 1]; System.arraycopy(existingImports, 0, newImports, 0, existingImports.length); newImports[existingImports.length] = pkgNameWithDot; setImportedPrefixes(newImports); } } importsUpdated = true; } return super.lookupType(name, location); } }
private final SimpleScope fakeRequestScope = new SimpleScope(); private final HttpServletRequest request = new FakeHttpServletRequest(); fakeRequestScope.exit() super.tearDown(); fakeRequestScope.enter(); fakeRequestScope.seed(FakeHttpServletRequest.class, request);
public AspectJTypeFilter(String typePatternExpression, @Nullable ClassLoader classLoader) { this.world = new BcelWorld(classLoader, IMessageHandler.THROW, null); this.world.setBehaveInJava5Way(true); PatternParser patternParser = new PatternParser(typePatternExpression); TypePattern typePattern = patternParser.parseTypePattern(); typePattern.resolve(this.world); IScope scope = new SimpleScope(this.world, new FormalBinding[0]); this.typePattern = typePattern.resolveBindings(scope, Bindings.NONE, false, false); }
public AspectJTypeFilter(String typePatternExpression, ClassLoader classLoader) { this.world = new BcelWorld(classLoader, IMessageHandler.THROW, null); this.world.setBehaveInJava5Way(true); PatternParser patternParser = new PatternParser(typePatternExpression); TypePattern typePattern = patternParser.parseTypePattern(); typePattern.resolve(this.world); IScope scope = new SimpleScope(this.world, new FormalBinding[0]); this.typePattern = typePattern.resolveBindings(scope, Bindings.NONE, false, false); }
public AspectJTypeFilter(String typePatternExpression, @Nullable ClassLoader classLoader) { this.world = new BcelWorld(classLoader, IMessageHandler.THROW, null); this.world.setBehaveInJava5Way(true); PatternParser patternParser = new PatternParser(typePatternExpression); TypePattern typePattern = patternParser.parseTypePattern(); typePattern.resolve(this.world); IScope scope = new SimpleScope(this.world, new FormalBinding[0]); this.typePattern = typePattern.resolveBindings(scope, Bindings.NONE, false, false); }
public AspectJTypeFilter(String typePatternExpression, @Nullable ClassLoader classLoader) { this.world = new BcelWorld(classLoader, IMessageHandler.THROW, null); this.world.setBehaveInJava5Way(true); PatternParser patternParser = new PatternParser(typePatternExpression); TypePattern typePattern = patternParser.parseTypePattern(); typePattern.resolve(this.world); IScope scope = new SimpleScope(this.world, new FormalBinding[0]); this.typePattern = typePattern.resolveBindings(scope, Bindings.NONE, false, false); }
public AspectJTypeFilter(String typePatternExpression, ClassLoader classLoader) { this.world = new BcelWorld(classLoader, IMessageHandler.THROW, null); this.world.setBehaveInJava5Way(true); PatternParser patternParser = new PatternParser(typePatternExpression); TypePattern typePattern = patternParser.parseTypePattern(); typePattern.resolve(this.world); IScope scope = new SimpleScope(this.world, new FormalBinding[0]); this.typePattern = typePattern.resolveBindings(scope, Bindings.NONE, false, false); }
private IScope buildResolutionScope(Class<?> inScope, PointcutParameter[] formalParameters) { if (formalParameters == null) { formalParameters = new PointcutParameter[0]; } FormalBinding[] formalBindings = new FormalBinding[formalParameters.length]; for (int i = 0; i < formalBindings.length; i++) { formalBindings[i] = new FormalBinding(toUnresolvedType(formalParameters[i].getType()), formalParameters[i].getName(), i); } if (inScope == null) { return new SimpleScope(getWorld(), formalBindings); } else { ResolvedType inType = getWorld().resolve(inScope.getName()); ISourceContext sourceContext = new ISourceContext() { public ISourceLocation makeSourceLocation(IHasPosition position) { return new SourceLocation(new File(""), 0); } public ISourceLocation makeSourceLocation(int line, int offset) { return new SourceLocation(new File(""), line); } public int getOffset() { return 0; } public void tidy() { } }; return new BindingScope(inType, sourceContext, formalBindings); } }