]> source.dussan.org Git - aspectj.git/commitdiff
trigger build
authoraclement <aclement>
Tue, 10 Feb 2009 16:44:00 +0000 (16:44 +0000)
committeraclement <aclement>
Tue, 10 Feb 2009 16:44:00 +0000 (16:44 +0000)
org.aspectj.matcher/src/org/aspectj/weaver/patterns/SimpleScope.java

index 08e3e70f3f293374418658ef24dee2fc07109083..63b5db3fd83d3deba6934a393dce7cd8a9e9235b 100644 (file)
@@ -10,7 +10,6 @@
  *     PARC     initial implementation 
  * ******************************************************************/
 
-
 package org.aspectj.weaver.patterns;
 
 import org.aspectj.bridge.IMessage;
@@ -25,40 +24,37 @@ import org.aspectj.weaver.World;
 
 public class SimpleScope implements IScope {
 
-    private World world;
-    private ResolvedType enclosingType;
-    protected FormalBinding[] bindings;
+       private World world;
+       private ResolvedType enclosingType;
+       protected FormalBinding[] bindings;
 
        private String[] importedPrefixes = javaLangPrefixArray;
        private String[] importedNames = ZERO_STRINGS;
        private static final String[] ZERO_STRINGS = new String[0];
-       
-       private static final String[] javaLangPrefixArray =
-               new String[] { "java.lang.", };
 
+       private static final String[] javaLangPrefixArray = new String[] { "java.lang.", };
 
-       
-    public SimpleScope(World world, FormalBinding[] bindings) {
-        super();
-        this.world = world;
-        this.bindings = bindings;
-    }
+       public SimpleScope(World world, FormalBinding[] bindings) {
+               super();
+               this.world = world;
+               this.bindings = bindings;
+       }
 
        // ---- impl
 
-       //XXX doesn't report any problems
+       // XXX doesn't report any problems
        public UnresolvedType lookupType(String name, IHasPosition location) {
-               for (int i=0; i<importedNames.length; i++) {
+               for (int i = 0; i < importedNames.length; i++) {
                        String importedName = importedNames[i];
-//                     // make sure we're matching against the
-//                     // type name rather than part of it
-//                     if (importedName.endsWith("." + name)) {
+                       // // make sure we're matching against the
+                       // // type name rather than part of it
+                       // if (importedName.endsWith("." + name)) {
                        if (importedName.endsWith(name)) {
                                return world.resolve(importedName);
                        }
                }
-               
-               for (int i=0; i<importedPrefixes.length; i++) {
+
+               for (int i = 0; i < importedPrefixes.length; i++) {
                        String importedPrefix = importedPrefixes[i];
                        ResolvedType tryType = world.resolve(UnresolvedType.forName(importedPrefix + name), true);
                        if (!tryType.isMissing()) {
@@ -69,77 +65,71 @@ public class SimpleScope implements IScope {
                return world.resolve(UnresolvedType.forName(name), true);
        }
 
+       public IMessageHandler getMessageHandler() {
+               return world.getMessageHandler();
+       }
+
+       public FormalBinding lookupFormal(String name) {
+               for (int i = 0, len = bindings.length; i < len; i++) {
+                       if (bindings[i].getName().equals(name))
+                               return bindings[i];
+               }
+               return null;
+       }
 
-    public IMessageHandler getMessageHandler() {
-        return world.getMessageHandler();
-    }
-    public FormalBinding lookupFormal(String name) {
-        for (int i = 0, len = bindings.length; i < len; i++) {
-            if (bindings[i].getName().equals(name)) return bindings[i];
-        }
-        return null;
-    }
-    public FormalBinding getFormal(int i) {
-        return bindings[i];
-    }
-    
-    public int getFormalCount() {
-       return bindings.length;
-    }
+       public FormalBinding getFormal(int i) {
+               return bindings[i];
+       }
+
+       public int getFormalCount() {
+               return bindings.length;
+       }
 
        public String[] getImportedNames() {
                return importedNames;
        }
+
        public String[] getImportedPrefixes() {
                return importedPrefixes;
        }
-       
+
        public void setImportedNames(String[] importedNames) {
                this.importedNames = importedNames;
        }
+
        public void setImportedPrefixes(String[] importedPrefixes) {
                this.importedPrefixes = importedPrefixes;
        }
-       
+
        public static FormalBinding[] makeFormalBindings(UnresolvedType[] types, String[] names) {
-        int len = types.length;
-        FormalBinding[] bindings = new FormalBinding[len];
-        for (int i = 0; i < len; i++) {
-            bindings[i] = new FormalBinding(types[i], names[i], i);
-        }
-        return bindings;
-       }
-       
-       // ---- fields
-       
+               int len = types.length;
+               FormalBinding[] bindings = new FormalBinding[len];
+               for (int i = 0; i < len; i++) {
+                       bindings[i] = new FormalBinding(types[i], names[i], i);
+               }
+               return bindings;
+       }
 
+       // ---- fields
 
        public ISourceLocation makeSourceLocation(IHasPosition location) {
                return new SourceLocation(ISourceLocation.NO_FILE, 0);
        }
 
-       public void message(
-               IMessage.Kind kind,
-               IHasPosition location1,
-               IHasPosition location2,
-               String message) {
-                       message(kind, location1, message);
-                       message(kind, location2, message);
+       public void message(IMessage.Kind kind, IHasPosition location1, IHasPosition location2, String message) {
+               message(kind, location1, message);
+               message(kind, location2, message);
        }
 
-       public void message(
-               IMessage.Kind kind,
-               IHasPosition location,
-               String message) {
-                       getMessageHandler()
-                       .handleMessage(new Message(message, kind, null, makeSourceLocation(location)));
+       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 World getWorld() {
                return world;
        }