JavaNativeMethodImpl_OpenJDK6.st
changeset 3199 189c572dbe71
parent 3176 243dcc6b3220
child 3203 185bbb8910e8
equal deleted inserted replaced
3192:b6bced0551a9 3199:189c572dbe71
  9957      *
  9957      *
  9958      * @return the declaring class for this class
  9958      * @return the declaring class for this class
  9959      * @since JDK1.1
  9959      * @since JDK1.1
  9960      */"
  9960      */"
  9961 
  9961 
  9962     | cls  enclosingClsName  enclosingCls |
  9962     | cls declaringClass |
  9963 
  9963 
  9964     cls := Reflection classForJavaClassObject: this.
  9964     cls := Reflection classForJavaClassObject: this.
  9965     (cls isJavaPrimitiveType or: [ cls isJavaArrayClass ]) ifTrue: [ ^ nil ].
  9965     (cls isJavaPrimitiveType or: [ cls isJavaArrayClass ]) ifTrue: [ ^ nil ].
  9966     (cls binaryName includes: $$) ifFalse: [ ^ nil ].
  9966     declaringClass := cls declaringClass.
  9967     enclosingClsName := cls binaryName copyTo: (cls binaryName lastIndexOf: $$) - 1.
  9967     declaringClass notNil ifTrue:[
  9968     enclosingCls := JavaVM classForName:enclosingClsName definedBy:nil.
  9968         ^ Reflection javaClassObjectForClass: declaringClass
  9969     enclosingCls isNil ifTrue: [ self error: 'Cannot fins declaring class' ].
  9969     ].
  9970     ^ Reflection javaClassObjectForClass: enclosingCls
  9970     ^ nil
  9971 
  9971 
  9972     "Modified: / 07-02-2014 / 09:44:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  9972     "Modified: / 04-08-2014 / 22:54:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  9973 !
  9973 !
  9974 
  9974 
  9975 _java_lang_Class_getDeclaringClass: this
  9975 _java_lang_Class_getDeclaringClass: this
  9976     <javanative: 'java/lang/Class' name: 'getDeclaringClass()Ljava/lang/Class;'>
  9976     <javanative: 'java/lang/Class' name: 'getDeclaringClass()Ljava/lang/Class;'>
  9977     "
  9977 
  9978      /**
  9978     ^ self _java_lang_Class_getDeclaringClass0: this
  9979      * If the class or interface represented by this {@code Class} object
  9979 
  9980      * is a member of another class, returns the {@code Class} object
  9980     "Modified: / 04-08-2014 / 22:39:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  9981      * representing the class in which it was declared.  This method returns
       
  9982      * null if this class or interface is not a member of any other class.  If
       
  9983      * this {@code Class} object represents an array class, a primitive
       
  9984      * type, or void,then this method returns null.
       
  9985      *
       
  9986      * @return the declaring class for this class
       
  9987      * @since JDK1.1
       
  9988      */"
       
  9989 
       
  9990     | cls  enclosingClsName  enclosingCls |
       
  9991 
       
  9992     cls := Reflection classForJavaClassObject: this.
       
  9993     (cls isJavaPrimitiveType or: [ cls isJavaArrayClass ]) ifTrue: [ ^ nil ].
       
  9994     (cls binaryName includes: $$) ifFalse: [ ^ nil ].
       
  9995     enclosingClsName := cls binaryName copyTo: (cls binaryName lastIndexOf: $$) - 1.
       
  9996     enclosingCls := JavaVM classForName:enclosingClsName definedBy:nil.
       
  9997     enclosingCls isNil ifTrue: [ self error: 'Cannot fins declaring class' ].
       
  9998     ^ Reflection javaClassObjectForClass: enclosingCls
       
  9999 
       
 10000     "Modified: / 07-11-2013 / 23:39:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
 10001 !
  9981 !
 10002 
  9982 
 10003 _java_lang_Class_getEnclosingMethod0: this
  9983 _java_lang_Class_getEnclosingMethod0: this
 10004 
  9984 
 10005     <javanative: 'java/lang/Class' name: 'getEnclosingMethod0()[Ljava/lang/Object;'>
  9985     <javanative: 'java/lang/Class' name: 'getEnclosingMethod0()[Ljava/lang/Object;'>