method resolving unified.. fields to follow jk_new_structure
authorhlopkmar
Wed, 07 Dec 2011 14:16:13 +0000
branchjk_new_structure
changeset 1235 8a3b56d4ba26
parent 1234 6ddf1122f94b
child 1236 8ca979c6e49b
method resolving unified.. fields to follow
src/JavaMethodRef2.st
src/JavaRef2.st
src/JavaResolver.st
src/stx_libjava.st
--- a/src/JavaMethodRef2.st	Wed Dec 07 13:38:08 2011 +0000
+++ b/src/JavaMethodRef2.st	Wed Dec 07 14:16:13 2011 +0000
@@ -64,15 +64,15 @@
 !JavaMethodRef2 methodsFor:'private - resolving'!
 
 findResolvedStaticValue
-    valueCache := JavaResolver uniqueInstance 
-                resolveStaticMethodIndentifiedByRef: self.
-    classCache := (constantPool at: classRefIndex) resolve.
-    classCache ifNil: [ self breakPoint: #mh ].
-    nameAndTypeCache := (constantPool at: nameAndTypeIndex) resolve.
-    nameAndTypeCache ifNil: [self breakPoint: #mh].
+    Logger 
+        log: self printString 
+                , ': findResolvedStaticValue is obsolete, call resolve its safe :)'
+        severity: #info
+        facility: #JVM.
+    self findResolvedValue.
 
     "Created: / 28-04-2011 / 22:45:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-    "Modified: / 18-05-2011 / 12:44:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+    "Modified: / 07-12-2011 / 15:10:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
 !
 
 findResolvedValue
--- a/src/JavaRef2.st	Wed Dec 07 13:38:08 2011 +0000
+++ b/src/JavaRef2.st	Wed Dec 07 14:16:13 2011 +0000
@@ -231,8 +231,9 @@
      Hides implementation details of the way of dealing with invalidation etc. User should not need to call anything
      else."
     
-    self isResolved ifFalse: [ self findResolvedStaticValue ].
-    ^ valueCache.
+    
+     self isResolved ifFalse: [ self findResolvedStaticValue ].
+         ^ valueCache.
 
     "Created: / 26-04-2011 / 13:19:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
 !
--- a/src/JavaResolver.st	Wed Dec 07 13:38:08 2011 +0000
+++ b/src/JavaResolver.st	Wed Dec 07 14:16:13 2011 +0000
@@ -376,7 +376,6 @@
 
 resolveStaticFieldIndentifiedByRef: aJavaFieldRef 
     | result  class |
-
     self validateFieldRef: aJavaFieldRef.
     result := self lookupFieldIfAlreadyResolved: aJavaFieldRef.
     result ifNotNil: [ ^ result ].
@@ -585,62 +584,6 @@
     "Created: / 11-04-2011 / 19:45:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
     "Modified: / 14-04-2011 / 00:01:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
     "Modified: / 10-08-2011 / 22:44:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-resolveStaticMethodIndentifiedByRef: aJavaMethodRef 
-    | result  class |
-
-    self validateMethodRef: aJavaMethodRef.
-    result := self lookupMethodIfAlreadyResolved: aJavaMethodRef.
-    result ifNotNil: [ ^ result ].
-    class := aJavaMethodRef classRef resolve.
-    class ifNil: [ self halt: 'should not happen - tell mh' ].
-     "
-     To resolve an unresolved symbolic reference from D to a method in
-     a class C, the symbolic reference to C given by the method reference
-     is first resolved (§5.4.3.1). Therefore, any exceptions that can be
-     thrown due to resolution of a class reference can be thrown as a result
-     of method resolution. If the reference to C can be successfully resolved,
-     exceptions relating to the resolution of the method reference itself
-     can be thrown.
-     When resolving a method reference:
-     
-     Method resolution checks whether C is a class or an interface.
-     If C is an interface, method resolution throws an IncompatibleClassChangeError."
-    class isInterface ifTrue: [ self throwIncompatibleClassChangeError ].
-     "Method resolution attempts to look up the referenced method in C and its
-     superclasses:
-     If C declares a method with the name and descriptor specified by the method
-     reference, method lookup succeeds.
-     Otherwise, if C has a superclass, step 2 of method lookup is recursively
-     invoked on the direct superclass of C.
-     
-     Otherwise, method lookup attempts to locate the referenced method in any of
-     the superinterfaces of the specified class C.
-     If any superinterface of C declares a method with the name and descriptor
-     specified by the method reference, method lookup succeeds.
-     Otherwise, method lookup fails.
-     If method lookup fails, method resolution throws a NoSuchMethodError. If method
-     lookup succeeds and the method is abstract, but C is not abstract, method resolution
-     throws an AbstractMethodError. Otherwise, if the referenced method is not accessible
-     (§5.4.4) to D, method resolution throws an IllegalAccessError."
-    result := class lookupStaticMethodByNameAndType: aJavaMethodRef nameAndType.
-    result ifNil: [ self throwNoSuchMethodError ].
-    (result isAbstract and: [ class isAbstract not ]) 
-        ifTrue: [ self throwAbstractMethodError ].
-    (self 
-        checkPermissionsForMethod: result
-        from: aJavaMethodRef classRef owner
-        to: class) ifFalse: [ self throwIllegalAccessError ].
-    ^ result.
-
-    "Otherwise, let <E, L1> be the class or interface in which the referenced method is
-     actually declared and let L2 be the defining loader of D. Let T0 be the name of
-     the type returned by the referenced method, and let T1, ..., Tn be the names of
-     the argument types of the referenced method. The Java virtual machine must impose
-     the loading constraints TiL1=TiL2 for i = 0 to n (§5.3.4)."
-
-    "Created: / 28-04-2011 / 22:50:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
 ! !
 
 !JavaResolver methodsFor:'method resolving helpers'!
--- a/src/stx_libjava.st	Wed Dec 07 13:38:08 2011 +0000
+++ b/src/stx_libjava.st	Wed Dec 07 14:16:13 2011 +0000
@@ -163,15 +163,15 @@
 
     ^ #(
         #'squeak:petitparser'    "PPCompositeParser - superclass of JavaParser "
-        #'stx:goodies/sunit'    "TestCase - superclass of JavaMethodRefTests "
-        #'stx:libbasic'    "LimitedPrecisionReal - superclass of extended ShortFloat "
+        #'stx:goodies/sunit'    "TestCase - superclass of JavaClassReader2Tests "
+        #'stx:libbasic'    "GenericException - superclass of JavaUnhandledExceptionError "
         #'stx:libbasic2'    "Socket - superclass of JavaSocket "
-        #'stx:libbasic3'    "MessageTracer - referenced by JavaMethod>>setBreakPoint "
+        #'stx:libbasic3'    "WrappedMethod - extended "
         #'stx:libcomp'    "ObjectFileLoader - referenced by JavaVM class>>_Runtime_loadFileInternalI: "
         #'stx:libhtml'    "URL - referenced by JavaEmbeddedFrameView>>setupAppletFrameIn:initializeJava: "
         #'stx:libtool'    "WorkspaceApplication - referenced by JavaEvaluator>>evaluate:in:receiver:notifying:logged:ifFail: "
         #'stx:libview'    "PopUpView - superclass of JavaPopUpView "
-        #'stx:libview2'    "Plug - referenced by JavaSourceCodeCache>>findMethodLine:inMethods: "
+        #'stx:libview2'    "GIFReader - referenced by JavaVM class>>_GifImageDecoder_parseImage: "
         #'stx:libwidg'    "ScrollBar - referenced by JavaVM class>>_WScrollPanePeer__getVScrollbarWidth: "
         #'stx:libwidg2'    "MenuPanel - referenced by JavaVM class>>processEvent: "
     )
@@ -526,6 +526,9 @@
         'WordArray class' javaComponentClass
         'WordArray class' javaName
         WrappedMethod isAbstract
+        'BooleanArray class' javaArrayClass
+        'DoubleArray class' javaArrayClass
+        'FloatArray class' javaArrayClass
     )
 ! !
 
@@ -578,7 +581,7 @@
     "Return a SVN revision number of myself.
      This number is updated after a commit"
 
-    ^ "$SVN-Revision:"'1577'"$"
+    ^ "$SVN-Revision:"        '1588M'"$"
 ! !
 
 !stx_libjava class methodsFor:'file generation'!