diff options
author | jfrijters <jfrijters> | 2014-06-04 18:32:09 +0400 |
---|---|---|
committer | jfrijters <jfrijters> | 2014-06-04 18:32:09 +0400 |
commit | 9e6bf6305de863ad63d622b9fc6e2dfa289572ca (patch) | |
tree | 1fbbeb9ea8585da987b3969b4fc34824a0a6689e /openjdk/java | |
parent | 05dbd6e3a4d041b7079031767960602b5a222ccc (diff) |
Simplified AnnotationType meta annotation handling.
Diffstat (limited to 'openjdk/java')
-rw-r--r-- | openjdk/java/lang/LangHelper.java | 88 |
1 files changed, 27 insertions, 61 deletions
diff --git a/openjdk/java/lang/LangHelper.java b/openjdk/java/lang/LangHelper.java index cc62d2cb..8d725d43 100644 --- a/openjdk/java/lang/LangHelper.java +++ b/openjdk/java/lang/LangHelper.java @@ -1,5 +1,5 @@ /* - Copyright (C) 2007-2011 Jeroen Frijters + Copyright (C) 2007-2014 Jeroen Frijters This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,80 +24,40 @@ package java.lang; -import ikvm.runtime.AssemblyClassLoader; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.security.AccessController; -import java.util.Enumeration; +import java.lang.annotation.Annotation; +import java.lang.reflect.Executable; +import java.security.AccessControlContext; import java.util.Map; import sun.nio.ch.Interruptible; import sun.reflect.annotation.AnnotationType; -import sun.security.action.GetPropertyAction; @ikvm.lang.Internal public class LangHelper { - private static boolean addedSystemPackages; - - private static void addSystemPackage(Map pkgMap) - { - // NOTE caller must have acquired lock on pkgMap - if (!addedSystemPackages) - { - addedSystemPackages = true; - String[] pkgs = getBootClassPackages(); - for (int i = 0; i < pkgs.length; i++) - { - pkgMap.put(pkgs[i], - new Package(pkgs[i], - VMSystemProperties.SPEC_TITLE, // specTitle - VMSystemProperties.SPEC_VERSION, // specVersion - VMSystemProperties.SPEC_VENDOR, // specVendor - "IKVM.NET OpenJDK", // implTitle - PropertyConstants.openjdk_version, // implVersion - "Oracle Corporation & others", // implVendor - null, // sealBase - null)); // class loader - } - } - } - - private static native String[] getBootClassPackages(); - - /* this method gets called by Package.getSystemPackage() via a redefined method in map.xml */ - static Package getSystemPackage(Map pkgs, String name) - { - synchronized (pkgs) - { - addSystemPackage(pkgs); - return (Package)pkgs.get(name); - } - } - - /* this method gets called by Package.getSystemPackages() via a redefined method in map.xml */ - static Package[] getSystemPackages(Map pkgs) - { - synchronized (pkgs) - { - addSystemPackage(pkgs); - return (Package[])pkgs.values().toArray(new Package[pkgs.size()]); - - } - } - public static sun.misc.JavaLangAccess getJavaLangAccess() { return new sun.misc.JavaLangAccess() { public sun.reflect.ConstantPool getConstantPool(Class klass) { - return null; + return klass.getConstantPool(); } - public void setAnnotationType(Class klass, AnnotationType type) { - klass.setAnnotationType(type); + public boolean casAnnotationType(Class<?> klass, AnnotationType oldType, AnnotationType newType) { + return klass.casAnnotationType(oldType, newType); } public AnnotationType getAnnotationType(Class klass) { return klass.getAnnotationType(); } + public Map<Class<? extends Annotation>, Annotation> getDeclaredAnnotationMap(Class<?> klass) { + return klass.getDeclaredAnnotationMap(); + } + public byte[] getRawClassAnnotations(Class<?> klass) { + throw new InternalError(); + } + public byte[] getRawClassTypeAnnotations(Class<?> klass) { + return klass.getRawTypeAnnotations(); + } + public byte[] getRawExecutableTypeAnnotations(Executable executable) { + return Class.getExecutableTypeAnnotationBytes(executable); + } public <E extends Enum<E>> E[] getEnumConstantsShared(Class<E> klass) { return klass.getEnumConstantsShared(); @@ -114,8 +74,14 @@ public class LangHelper public StackTraceElement getStackTraceElement(Throwable t, int i) { return t.getStackTraceElement(i); } - public int getStringHash32(String string) { - return StringHelper.hash32(string); + public String newStringUnsafe(char[] chars) { + return String.valueOf(chars); + } + public Thread newThreadWithAcc(Runnable target, AccessControlContext acc) { + return new Thread(target, acc); + } + public void invokeFinalize(Object o) throws Throwable { + // we don't actually support invoking the finalize method explicitly } }; } |