From d85c0b6f6fc99c3c707ea120893b088231fa4f5e Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Tue, 3 Jul 2012 16:01:59 -0700 Subject: [PATCH] 7181501: Add some GenerateNativeHeader annotations and misc Mac adjustments to makefiles Reviewed-by: ohair --- jdk/src/macosx/native/jobjc/build.xml | 12 +++++-- .../native/jobjc/src/core/PrimitiveCoder.hs | 7 ++++- .../src/core/java/com/apple/jobjc/CFType.java | 4 +++ .../src/core/java/com/apple/jobjc/Coder.java | 17 ++++++++++ .../core/java/com/apple/jobjc/FFIType.java | 4 +++ .../core/java/com/apple/jobjc/Function.java | 4 +++ .../src/core/java/com/apple/jobjc/ID.java | 4 +++ .../src/core/java/com/apple/jobjc/Invoke.java | 10 ++++++ .../java/com/apple/jobjc/JObjCRuntime.java | 6 ++++ .../java/com/apple/jobjc/MacOSXFramework.java | 4 +++ .../core/java/com/apple/jobjc/NSClass.java | 6 ++++ .../com/apple/jobjc/NativeArgumentBuffer.java | 4 +++ .../java/com/apple/jobjc/NativeBuffer.java | 4 +++ .../jobjc/NativeObjectLifecycleManager.java | 10 ++++++ .../src/core/java/com/apple/jobjc/Opaque.java | 4 +++ .../core/java/com/apple/jobjc/Pointer.java | 4 +++ .../java/com/apple/jobjc/PrimitiveCoder.java | 31 ++++++++++++++++++- .../src/core/java/com/apple/jobjc/SEL.java | 4 +++ .../src/core/java/com/apple/jobjc/Struct.java | 4 +++ .../java/com/apple/jobjc/Subclassing.java | 4 +++ .../generator/classes/FrameworkClassFile.java | 7 ++++- .../internal/jobjc/generator/model/Clazz.java | 4 +++ .../model/coders/ComplexCoderDescriptor.java | 7 +++-- 23 files changed, 157 insertions(+), 8 deletions(-) diff --git a/jdk/src/macosx/native/jobjc/build.xml b/jdk/src/macosx/native/jobjc/build.xml index 46e726c6278..19e29ad51af 100644 --- a/jdk/src/macosx/native/jobjc/build.xml +++ b/jdk/src/macosx/native/jobjc/build.xml @@ -140,8 +140,16 @@ - + includeantruntime="false"> + + + + + + + + + diff --git a/jdk/src/macosx/native/jobjc/src/core/PrimitiveCoder.hs b/jdk/src/macosx/native/jobjc/src/core/PrimitiveCoder.hs index 544998ee859..2759733ec6f 100644 --- a/jdk/src/macosx/native/jobjc/src/core/PrimitiveCoder.hs +++ b/jdk/src/macosx/native/jobjc/src/core/PrimitiveCoder.hs @@ -2,7 +2,7 @@ {- /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011,2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -196,6 +196,8 @@ sizeofRet nt = c2java ntype = unlines [ "// native " ++ ntypeS ++ " -> java " ++ jprimS, + "/* No native methods here, but the constants are needed in the supporting JNI code */", + "@GenerateNativeHeader", "public static final class " ++ className ++ " extends PrimitiveCoder<" ++ jclassS ++ ">{", "\tpublic static final " ++ className ++ " INST = new " ++ className ++ "();", "\tpublic " ++ className ++ "(){ super("++ffitypeVal ntype++", \"" ++ [encoding ntype] ++ "\", "++jclassS++".class, "++jprimS++".class); }", @@ -246,10 +248,13 @@ main = do putStrLn "package com.apple.jobjc;" putStrLn "import com.apple.jobjc.JObjCRuntime.Width;" + putStrLn "import javax.tools.annotation.GenerateNativeHeader;" putStrLn "// Auto generated by PrimitiveCoder.hs" putStrLn "// Do not edit by hand." + putStrLn "/* No native methods here, but the constants are needed in the supporting JNI code */" + putStrLn "@GenerateNativeHeader" putStrLn "public abstract class PrimitiveCoder extends Coder{" putStrLn "\tpublic PrimitiveCoder(int ffiTypeCode, String objCEncoding, Class jclass, Class jprim){" diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/CFType.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/CFType.java index aeeca30d29e..835b3793538 100644 --- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/CFType.java +++ b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/CFType.java @@ -24,6 +24,10 @@ */ package com.apple.jobjc; +import javax.tools.annotation.GenerateNativeHeader; + +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public class CFType extends Pointer { protected CFType(long ptr) { super(ptr); } protected CFType(Pointer ptr) { super(ptr.ptr); } diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Coder.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Coder.java index a6a714f3933..f1bc68283ac 100644 --- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Coder.java +++ b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Coder.java @@ -35,6 +35,7 @@ import com.apple.jobjc.PrimitiveCoder.SCharCoder; import com.apple.jobjc.PrimitiveCoder.SIntCoder; import com.apple.jobjc.PrimitiveCoder.SLongLongCoder; import com.apple.jobjc.PrimitiveCoder.SShortCoder; +import javax.tools.annotation.GenerateNativeHeader; public abstract class Coder { private static native long getNativeFFITypePtrForCode(final int code); @@ -142,6 +143,8 @@ public abstract class Coder { // + /* No native methods here, but the constants are needed in the supporting JNI code */ + @GenerateNativeHeader public static final class VoidCoder extends Coder{ public static final VoidCoder INST = new VoidCoder(); public VoidCoder(){ super(FFI_VOID, "v", Void.class, void.class); } @@ -150,6 +153,8 @@ public abstract class Coder { @Override public void push(JObjCRuntime runtime, long addr, Object x) { throw new RuntimeException("Trying to push a Void."); } } + /* No native methods here, but the constants are needed in the supporting JNI code */ + @GenerateNativeHeader public static final class UnknownCoder extends Coder { public static final UnknownCoder INST = new UnknownCoder(); public UnknownCoder(){ super(-1, "?", null, null); } @@ -158,6 +163,8 @@ public abstract class Coder { @Override public Object pop(JObjCRuntime runtime, long addr) { throw new RuntimeException("Coder not implemented"); } } + /* No native methods here, but the constants are needed in the supporting JNI code */ + @GenerateNativeHeader public static final class PrimitivePointerCoder extends Coder { public static final PrimitivePointerCoder INST = new PrimitivePointerCoder(); public PrimitivePointerCoder(){ super(Coder.FFI_PTR, "^?", Long.class, long.class); } @@ -187,6 +194,8 @@ public abstract class Coder { @Override public void push(JObjCRuntime runtime, long addr, Long x) { push(runtime, addr, (long) x); } } + /* No native methods here, but the constants are needed in the supporting JNI code */ + @GenerateNativeHeader public static final class PointerCoder extends Coder { public static final PointerCoder INST = new PointerCoder(); public PointerCoder(){ super(FFI_PTR, "^?", Pointer.class); } @@ -200,6 +209,8 @@ public abstract class Coder { } } + /* No native methods here, but the constants are needed in the supporting JNI code */ + @GenerateNativeHeader public static final class SELCoder extends Coder { public static final SELCoder INST = new SELCoder(); public SELCoder(){ super(FFI_PTR, ":", SEL.class); } @@ -213,6 +224,8 @@ public abstract class Coder { } } + /* No native methods here, but the constants are needed in the supporting JNI code */ + @GenerateNativeHeader public static abstract class StructCoder extends Coder { private final FFIType ffiType; final int sizeof; @@ -254,6 +267,8 @@ public abstract class Coder { } } + /* No native methods here, but the constants are needed in the supporting JNI code */ + @GenerateNativeHeader public static final class IDCoder extends Coder{ public static final IDCoder INST = new IDCoder(); public IDCoder(){ super(FFI_PTR, "@", ID.class); } @@ -272,6 +287,8 @@ public abstract class Coder { } } + /* No native methods here, but the constants are needed in the supporting JNI code */ + @GenerateNativeHeader public static final class NSClassCoder extends Coder{ public static final NSClassCoder INST = new NSClassCoder(); public NSClassCoder(){ super(FFI_PTR, "#", NSClass.class); } diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/FFIType.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/FFIType.java index fcfddd6edec..c045b210c6c 100644 --- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/FFIType.java +++ b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/FFIType.java @@ -26,6 +26,10 @@ package com.apple.jobjc; import com.apple.jobjc.Coder.PrimitivePointerCoder; +import javax.tools.annotation.GenerateNativeHeader; + +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader class FFIType{ private static native void makeFFIType(long ffi_type_buf, long elements_buf); private static native int getFFITypeSizeof(); diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Function.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Function.java index 0acfccce91d..b5257cc83ef 100644 --- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Function.java +++ b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Function.java @@ -24,6 +24,10 @@ */ package com.apple.jobjc; +import javax.tools.annotation.GenerateNativeHeader; + +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public class Function { private static native long getFxnPtrForFunctionName(final String functionName); private static native long getFxnPtrForFunctionNameAndLib(final long libPtr, final String functionName); diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/ID.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/ID.java index f2b3718df7e..192e6feafa0 100644 --- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/ID.java +++ b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/ID.java @@ -29,6 +29,10 @@ import java.lang.reflect.Constructor; import java.util.LinkedHashMap; import java.util.Map; +import javax.tools.annotation.GenerateNativeHeader; + +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public class ID extends Pointer{ static native String getNativeDescription(final long objPtr); diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Invoke.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Invoke.java index c6cab308a93..19e79ddc165 100644 --- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Invoke.java +++ b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Invoke.java @@ -30,12 +30,18 @@ import com.apple.jobjc.Coder.PrimitivePointerCoder; import com.apple.jobjc.Coder.SELCoder; import com.apple.jobjc.Coder.StructCoder; +import javax.tools.annotation.GenerateNativeHeader; + +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public abstract class Invoke { public abstract void invoke(NativeArgumentBuffer argBuf); public abstract void invoke(NativeArgumentBuffer buffer, Struct retvalStruct); // + /* No native methods here, but the constants are needed in the supporting JNI code */ + @GenerateNativeHeader public static final class FunCall extends Invoke{ static native void invoke(long cifPtr, long fxnPtr, long retValPtr, long argsPtr); @@ -72,6 +78,8 @@ public abstract class Invoke { } } + /* No native methods here, but the constants are needed in the supporting JNI code */ + @GenerateNativeHeader public static final class MsgSend extends Invoke{ static{ System.load("/usr/lib/libobjc.dylib"); } @@ -157,6 +165,8 @@ public abstract class Invoke { } } + /* No native methods here, but the constants are needed in the supporting JNI code */ + @GenerateNativeHeader public static final class MsgSendSuper extends Invoke{ static{ System.load("/usr/lib/libobjc.dylib"); } diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/JObjCRuntime.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/JObjCRuntime.java index b5e08478c1c..03f636696b2 100644 --- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/JObjCRuntime.java +++ b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/JObjCRuntime.java @@ -31,10 +31,16 @@ import java.util.List; import sun.misc.Unsafe; +import javax.tools.annotation.GenerateNativeHeader; + +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public final class JObjCRuntime { static { System.loadLibrary("JObjC"); } + @GenerateNativeHeader public static enum Arch{ ppc, i386, x86_64 }; + @GenerateNativeHeader public static enum Width{ W32, W64 }; public static final Arch ARCH = getArch(); diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/MacOSXFramework.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/MacOSXFramework.java index bfc77501db8..09737c80925 100644 --- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/MacOSXFramework.java +++ b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/MacOSXFramework.java @@ -25,6 +25,10 @@ package com.apple.jobjc; +import javax.tools.annotation.GenerateNativeHeader; + +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public class MacOSXFramework { private static native long retainFramework(final String frameworkName); private static native void releaseFramework(final long frameworkPtr); diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NSClass.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NSClass.java index dbc784f6940..15de180200d 100644 --- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NSClass.java +++ b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NSClass.java @@ -27,7 +27,13 @@ package com.apple.jobjc; import java.lang.ref.WeakReference; import java.lang.reflect.Constructor; +import javax.tools.annotation.GenerateNativeHeader; + +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public class NSClass extends ID { + /* No native methods here, but the constants are needed in the supporting JNI code */ + @GenerateNativeHeader public static class NSClassNotFoundException extends RuntimeException{ public NSClassNotFoundException(String m){ super(m); } public NSClassNotFoundException(String m, Throwable cause){ super(m, cause); } diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeArgumentBuffer.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeArgumentBuffer.java index 1e3c42452bf..3a6a792af56 100644 --- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeArgumentBuffer.java +++ b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeArgumentBuffer.java @@ -28,6 +28,10 @@ import java.nio.ByteOrder; import com.apple.jobjc.Coder.PrimitivePointerCoder; +import javax.tools.annotation.GenerateNativeHeader; + +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public final class NativeArgumentBuffer{ private static final ThreadLocal threadLocal = new ThreadLocal(); diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeBuffer.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeBuffer.java index ee0ac05d687..f7285f145a5 100644 --- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeBuffer.java +++ b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeBuffer.java @@ -27,9 +27,13 @@ package com.apple.jobjc; import java.nio.ByteBuffer; import java.nio.ByteOrder; +import javax.tools.annotation.GenerateNativeHeader; + /** * A wrapper around a direct ByteBuffer and its native pointer. For documentation, @see java.nio.ByteBuffer */ +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public class NativeBuffer { static native long getPtrOfBuffer(final ByteBuffer byteBuffer); diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeObjectLifecycleManager.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeObjectLifecycleManager.java index b4d3dbfe0b8..928f0012425 100644 --- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeObjectLifecycleManager.java +++ b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/NativeObjectLifecycleManager.java @@ -24,6 +24,10 @@ */ package com.apple.jobjc; +import javax.tools.annotation.GenerateNativeHeader; + +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public abstract class NativeObjectLifecycleManager { private static native void retainNativeObject(final long ptr); private static native void releaseNativeObject(final long ptr); @@ -33,6 +37,8 @@ public abstract class NativeObjectLifecycleManager { abstract void end(final long ptr); boolean shouldPreRetain() { return false; } + /* No native methods here, but the constants are needed in the supporting JNI code */ + @GenerateNativeHeader public static class CFRetainRelease extends NativeObjectLifecycleManager { public static final NativeObjectLifecycleManager INST = new CFRetainRelease(); @Override void begin(final long ptr) { retainNativeObject(ptr); } @@ -40,12 +46,16 @@ public abstract class NativeObjectLifecycleManager { @Override boolean shouldPreRetain() { return true; } } + /* No native methods here, but the constants are needed in the supporting JNI code */ + @GenerateNativeHeader public static class Free extends NativeObjectLifecycleManager { public static final NativeObjectLifecycleManager INST = new Free(); @Override void begin(final long ptr) { } @Override void end(final long ptr) { freeNativeObject(ptr); } } + /* No native methods here, but the constants are needed in the supporting JNI code */ + @GenerateNativeHeader public static class Nothing extends NativeObjectLifecycleManager { public static final NativeObjectLifecycleManager INST = new Nothing(); @Override void begin(final long ptr) { } diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Opaque.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Opaque.java index cbc5acca39e..82bceb93ce8 100644 --- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Opaque.java +++ b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Opaque.java @@ -24,6 +24,10 @@ */ package com.apple.jobjc; +import javax.tools.annotation.GenerateNativeHeader; + +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public class Opaque extends Pointer { protected Opaque(long ptr) { super(ptr); } protected Opaque(Pointer ptr) { super(ptr.ptr); } diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Pointer.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Pointer.java index 5d8c3c85c2e..cc0487f2e69 100644 --- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Pointer.java +++ b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Pointer.java @@ -24,6 +24,10 @@ */ package com.apple.jobjc; +import javax.tools.annotation.GenerateNativeHeader; + +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public class Pointer implements Comparable>{ long ptr; diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/PrimitiveCoder.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/PrimitiveCoder.java index 8dcc42482da..975b88848d5 100644 --- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/PrimitiveCoder.java +++ b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/PrimitiveCoder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011,2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,11 @@ */ package com.apple.jobjc; import com.apple.jobjc.JObjCRuntime.Width; +import javax.tools.annotation.GenerateNativeHeader; // Auto generated by PrimitiveCoder.hs // Do not edit by hand. +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public abstract class PrimitiveCoder extends Coder{ public PrimitiveCoder(int ffiTypeCode, String objCEncoding, Class jclass, Class jprim){ super(ffiTypeCode, objCEncoding, jclass, jprim); @@ -127,6 +130,8 @@ public abstract class PrimitiveCoder extends Coder{ // native BOOL -> java boolean +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public static final class BoolCoder extends PrimitiveCoder{ public static final BoolCoder INST = new BoolCoder(); public BoolCoder(){ super(FFI_SINT8, "B", Boolean.class, boolean.class); } @@ -170,6 +175,8 @@ public static final class BoolCoder extends PrimitiveCoder{ } // native schar -> java byte +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public static final class SCharCoder extends PrimitiveCoder{ public static final SCharCoder INST = new SCharCoder(); public SCharCoder(){ super(FFI_SINT8, "c", Byte.class, byte.class); } @@ -213,6 +220,8 @@ public static final class SCharCoder extends PrimitiveCoder{ } // native uchar -> java byte +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public static final class UCharCoder extends PrimitiveCoder{ public static final UCharCoder INST = new UCharCoder(); public UCharCoder(){ super(FFI_UINT8, "C", Byte.class, byte.class); } @@ -256,6 +265,8 @@ public static final class UCharCoder extends PrimitiveCoder{ } // native sshort -> java short +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public static final class SShortCoder extends PrimitiveCoder{ public static final SShortCoder INST = new SShortCoder(); public SShortCoder(){ super(FFI_SINT16, "s", Short.class, short.class); } @@ -299,6 +310,8 @@ public static final class SShortCoder extends PrimitiveCoder{ } // native ushort -> java short +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public static final class UShortCoder extends PrimitiveCoder{ public static final UShortCoder INST = new UShortCoder(); public UShortCoder(){ super(FFI_UINT16, "S", Short.class, short.class); } @@ -342,6 +355,8 @@ public static final class UShortCoder extends PrimitiveCoder{ } // native sint -> java int +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public static final class SIntCoder extends PrimitiveCoder{ public static final SIntCoder INST = new SIntCoder(); public SIntCoder(){ super(FFI_SINT32, "i", Integer.class, int.class); } @@ -385,6 +400,8 @@ public static final class SIntCoder extends PrimitiveCoder{ } // native uint -> java int +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public static final class UIntCoder extends PrimitiveCoder{ public static final UIntCoder INST = new UIntCoder(); public UIntCoder(){ super(FFI_UINT32, "I", Integer.class, int.class); } @@ -428,6 +445,8 @@ public static final class UIntCoder extends PrimitiveCoder{ } // native slong -> java long +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public static final class SLongCoder extends PrimitiveCoder{ public static final SLongCoder INST = new SLongCoder(); public SLongCoder(){ super((JObjCRuntime.IS64 ? (FFI_SINT64) : (FFI_SINT32)), "l", Long.class, long.class); } @@ -477,6 +496,8 @@ public static final class SLongCoder extends PrimitiveCoder{ } // native ulong -> java long +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public static final class ULongCoder extends PrimitiveCoder{ public static final ULongCoder INST = new ULongCoder(); public ULongCoder(){ super((JObjCRuntime.IS64 ? (FFI_UINT64) : (FFI_UINT32)), "L", Long.class, long.class); } @@ -526,6 +547,8 @@ public static final class ULongCoder extends PrimitiveCoder{ } // native slonglong -> java long +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public static final class SLongLongCoder extends PrimitiveCoder{ public static final SLongLongCoder INST = new SLongLongCoder(); public SLongLongCoder(){ super(FFI_SINT64, "q", Long.class, long.class); } @@ -569,6 +592,8 @@ public static final class SLongLongCoder extends PrimitiveCoder{ } // native ulonglong -> java long +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public static final class ULongLongCoder extends PrimitiveCoder{ public static final ULongLongCoder INST = new ULongLongCoder(); public ULongLongCoder(){ super(FFI_UINT64, "Q", Long.class, long.class); } @@ -612,6 +637,8 @@ public static final class ULongLongCoder extends PrimitiveCoder{ } // native float -> java float +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public static final class FloatCoder extends PrimitiveCoder{ public static final FloatCoder INST = new FloatCoder(); public FloatCoder(){ super(FFI_FLOAT, "f", Float.class, float.class); } @@ -655,6 +682,8 @@ public static final class FloatCoder extends PrimitiveCoder{ } // native double -> java double +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public static final class DoubleCoder extends PrimitiveCoder{ public static final DoubleCoder INST = new DoubleCoder(); public DoubleCoder(){ super(FFI_DOUBLE, "d", Double.class, double.class); } diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/SEL.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/SEL.java index b6d719e1158..44d679ab539 100644 --- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/SEL.java +++ b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/SEL.java @@ -24,6 +24,10 @@ */ package com.apple.jobjc; +import javax.tools.annotation.GenerateNativeHeader; + +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public class SEL { static native long getSelectorPtr(String selectorName); static native String getSelectorName(long ptr); diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Struct.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Struct.java index 8329cf17f04..117710402e8 100644 --- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Struct.java +++ b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Struct.java @@ -24,9 +24,13 @@ */ package com.apple.jobjc; +import javax.tools.annotation.GenerateNativeHeader; + /** * A struct is malloced on the C heap and accessed in Java through a ByteBuffer. */ +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader public abstract class Struct{ protected final NativeBuffer raw; private final JObjCRuntime runtime; diff --git a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Subclassing.java b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Subclassing.java index b2084dfd706..d3bfc1b0e41 100644 --- a/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Subclassing.java +++ b/jdk/src/macosx/native/jobjc/src/core/java/com/apple/jobjc/Subclassing.java @@ -33,6 +33,10 @@ import com.apple.jobjc.Coder.PrimitivePointerCoder; import com.apple.jobjc.Coder.VoidCoder; import com.apple.jobjc.Invoke.MsgSend; +import javax.tools.annotation.GenerateNativeHeader; + +/* No native methods here, but the constants are needed in the supporting JNI code */ +@GenerateNativeHeader final class Subclassing { static native long allocateClassPair(long superClass, String name); static native boolean addIVarForJObj(long clazz); diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/FrameworkClassFile.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/FrameworkClassFile.java index 20b27b6c548..8a27daaa0af 100644 --- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/FrameworkClassFile.java +++ b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/classes/FrameworkClassFile.java @@ -28,6 +28,7 @@ import java.io.File; import java.io.PrintStream; import java.util.ArrayList; import java.util.List; +import java.util.TreeSet; import com.apple.internal.jobjc.generator.FunctionGenerator; import com.apple.internal.jobjc.generator.Utils; @@ -130,7 +131,11 @@ public class FrameworkClassFile extends GeneratedClassFile { } } - for (final Clazz clazz : framework.classes) { + /** + * Order classes to get stable output + */ + TreeSet sortedClasses = new TreeSet(framework.classes); + for (final Clazz clazz : sortedClasses) { final String classClassName = clazz.name + "Class"; out.println(JavaLang.makeSingleton("_" + classClassName, clazz.name, classClassName, "getRuntime()")); } diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Clazz.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Clazz.java index 9dfb8228a82..be4278ffef9 100644 --- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Clazz.java +++ b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/Clazz.java @@ -147,4 +147,8 @@ public class Clazz extends Element implements OutputFileGenerator { return null; } + + int compareTo(Clazz o) { + return toString().compareTo(o.toString()); + } } diff --git a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/coders/ComplexCoderDescriptor.java b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/coders/ComplexCoderDescriptor.java index 11ee8cc9fe3..7ffb14b0f31 100644 --- a/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/coders/ComplexCoderDescriptor.java +++ b/jdk/src/macosx/native/jobjc/src/generator/java/com/apple/internal/jobjc/generator/model/coders/ComplexCoderDescriptor.java @@ -25,7 +25,7 @@ package com.apple.internal.jobjc.generator.model.coders; import java.util.HashMap; -import java.util.HashSet; +import java.util.TreeSet; import java.util.Map; import java.util.Set; @@ -40,7 +40,7 @@ import com.apple.jobjc.JObjCRuntime; */ public class ComplexCoderDescriptor extends CoderDescriptor { static Map, ComplexCoderDescriptor> cache = new HashMap, ComplexCoderDescriptor>(); - static Set mixedEncodingDescriptors = new HashSet(); + static Set mixedEncodingDescriptors = new TreeSet(); public static Set getMixedEncoders() { return mixedEncodingDescriptors; } @@ -76,7 +76,7 @@ public class ComplexCoderDescriptor extends CoderDescriptor { // ** Subclasses // ------------- - public static class MixedEncodingDescriptor extends ComplexCoderDescriptor { + public static class MixedEncodingDescriptor extends ComplexCoderDescriptor implements java.lang.Comparable { protected final PrimitiveCoderDescriptor desc32; public MixedEncodingDescriptor(final PrimitiveCoderDescriptor desc32, final PrimitiveCoderDescriptor desc64) { @@ -97,5 +97,6 @@ public class ComplexCoderDescriptor extends CoderDescriptor { } static String getBaseNameOfCoder(final String coderName) { return coderName.substring(0, coderName.indexOf("Coder")); } + public int compareTo(Object _o) { MixedEncodingDescriptor o = (MixedEncodingDescriptor)_o; return getMixedName().compareTo(o.getMixedName()); } } }