/[classpath]/classpath/java/lang/Class.java
ViewVC logotype

Diff of /classpath/java/lang/Class.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by cbj, Thu Apr 17 12:32:29 2003 UTC revision 1.9 by mark, Thu Jul 17 15:04:37 2003 UTC
# Line 1  Line 1 
1  /* Class.java -- Reference implementation of access to object metadata  /* Class.java -- Reference implementation of access to object metadata
2     Copyright (C) 1998, 2002 Free Software Foundation     Copyright (C) 1998, 2002, 2003 Free Software Foundation
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 258  public final class Class implements Seri Line 258  public final class Class implements Seri
258          }          }
259          if (constructor == null)          if (constructor == null)
260              throw new InstantiationException(getName());              throw new InstantiationException(getName());
261        }          if (!Modifier.isPublic(constructor.getModifiers()))
     int modifiers = constructor.getModifiers();  
     if (!Modifier.isPublic(modifiers))  
       {  
         Class caller = VMSecurityManager.getClassContext()[1];  
         if (caller != this &&  
             (Modifier.isPrivate(modifiers) || getClassLoader() != caller.getClassLoader() ||  
             !ClassHelper.getPackagePortion(getName()).equals(ClassHelper.getPackagePortion(caller.getName()))))  
             throw new IllegalAccessException(getName() + " has an inaccessible constructor");  
         if (!constructor.isAccessible())  
262            {            {
263              final Constructor finalConstructor = constructor;              final Constructor finalConstructor = constructor;
264              AccessController.doPrivileged(new PrivilegedAction() {              AccessController.doPrivileged(new PrivilegedAction() {
# Line 276  public final class Class implements Seri Line 267  public final class Class implements Seri
267                      return null;                      return null;
268                  }                  }
269              });              });
             synchronized(this)  
               {  
                 if (this.constructor == null)  
                     this.constructor = constructor;  
               }  
270            }            }
271            synchronized(this)
272              {
273                if (this.constructor == null)
274                    this.constructor = constructor;
275              }        
276          }
277        int modifiers = constructor.getModifiers();
278        if (!Modifier.isPublic(modifiers))
279          {
280            Class caller = VMSecurityManager.getClassContext()[1];
281            if (caller != this &&
282                (Modifier.isPrivate(modifiers)
283                 || getClassLoader() != caller.getClassLoader()
284                 || !ClassHelper.getPackagePortion(getName())
285                    .equals(ClassHelper.getPackagePortion(caller.getName()))))
286                throw new IllegalAccessException(getName()
287                                + " has an inaccessible constructor");
288        }        }
289      try      try
290        {        {
# Line 290  public final class Class implements Seri Line 293  public final class Class implements Seri
293      catch (InvocationTargetException e)      catch (InvocationTargetException e)
294        {        {
295          VMClass.throwException(e.getTargetException());          VMClass.throwException(e.getTargetException());
296          throw (InternalError) new InternalError("VMClass.throwException returned").initCause(e);          throw (InternalError) new InternalError
297                    ("VMClass.throwException returned").initCause(e);
298        }        }
299    }    }
300    

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26