--- a/JavaResolver.st Mon Aug 04 15:43:51 2014 +0100
+++ b/JavaResolver.st Mon Aug 04 16:13:14 2014 +0100
@@ -333,19 +333,26 @@
!JavaResolver methodsFor:'field resolving'!
-resolveFieldIndentifiedByRef: aJavaFieldRef
+resolveFieldIndentifiedByRef:aJavaFieldRef
| result class |
- self validateFieldRef: aJavaFieldRef.
- result := self lookupFieldIfAlreadyResolved: aJavaFieldRef.
- result ifNotNil: [ ^ result ].
- class := aJavaFieldRef classRef resolve: false.
- class ifNil: [ self error: 'should not happen - tell mh' ].
- result := class lookupFieldByNameAndType: aJavaFieldRef nameAndType.
- result ifNil: [ self throwNoSuchFieldException ].
+
+ self validateFieldRef:aJavaFieldRef.
+ result := self lookupFieldIfAlreadyResolved:aJavaFieldRef.
+ result notNil ifTrue:[
+ ^ result
+ ].
+ class := aJavaFieldRef classRef resolve:false.
+ class isNil ifTrue:[
+ self error:'should not happen - tell mh'
+ ].
+ result := class lookupFieldByNameAndType:aJavaFieldRef nameAndType.
+ result isNil ifTrue:[
+ self throwNoSuchFieldException
+ ].
(self
- checkPermissionsForField: result
- from: aJavaFieldRef classRef owner
- to: class) ifFalse: [ self throwIllegalAccessError ].
+ checkPermissionsForField:result
+ from:aJavaFieldRef classRef owner
+ to:class) ifFalse:[ self throwIllegalAccessError ].
^ result.
"
@@ -379,21 +386,29 @@
"Created: / 11-04-2011 / 21:15:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
"Modified: / 01-12-2012 / 13:45:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 04-08-2014 / 15:52:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
-resolveStaticFieldIndentifiedByRef: aJavaFieldRef
+resolveStaticFieldIndentifiedByRef:aJavaFieldRef
| result class |
- self validateFieldRef: aJavaFieldRef.
- result := self lookupFieldIfAlreadyResolved: aJavaFieldRef.
- result ifNotNil: [ ^ result ].
- class := aJavaFieldRef classRef resolve: false.
- class ifNil: [ self error: 'should not happen - tell mh' ].
- result := class lookupStaticFieldByNameAndType: aJavaFieldRef nameAndType.
- result ifNil: [ self throwNoSuchFieldException ].
+
+ self validateFieldRef:aJavaFieldRef.
+ result := self lookupFieldIfAlreadyResolved:aJavaFieldRef.
+ result notNil ifTrue:[
+ ^ result
+ ].
+ class := aJavaFieldRef classRef resolve:false.
+ class isNil ifTrue:[
+ self error:'should not happen - tell mh'
+ ].
+ result := class lookupStaticFieldByNameAndType:aJavaFieldRef nameAndType.
+ result isNil ifTrue:[
+ self throwNoSuchFieldException
+ ].
(self
- checkPermissionsForField: result
- from: aJavaFieldRef classRef owner
- to: class) ifFalse: [ self throwIllegalAccessError ].
+ checkPermissionsForField:result
+ from:aJavaFieldRef classRef owner
+ to:class) ifFalse:[ self throwIllegalAccessError ].
^ result.
"
@@ -427,6 +442,7 @@
"Created: / 28-04-2011 / 22:31:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
"Modified: / 01-12-2012 / 13:45:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+ "Modified: / 04-08-2014 / 15:52:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaResolver methodsFor:'field resolving helpers'!
@@ -524,16 +540,21 @@
!JavaResolver methodsFor:'method resolving'!
-resolveMethodIndentifiedByRef: aJavaMethodRef
+resolveMethodIndentifiedByRef:aJavaMethodRef
| result class |
- self validateMethodRef: aJavaMethodRef.
- result := self lookupMethodIfAlreadyResolved: aJavaMethodRef.
- result notNil ifTrue: [ ^ result ].
- class := aJavaMethodRef classRef resolve: false.
- class isNil ifTrue: [ self error: 'should not happen - tell mh' ].
+
+ self validateMethodRef:aJavaMethodRef.
+ result := self lookupMethodIfAlreadyResolved:aJavaMethodRef.
+ result notNil ifTrue:[
+ ^ result
+ ].
+ class := aJavaMethodRef classRef resolve:false.
+ class isNil ifTrue:[
+ self error:'should not happen - tell mh'
+ ].
"Array types responds to all method of class java.lang.Object"
- class isJavaArrayClass ifTrue: [
- class := JavaVM classForName: 'java.lang.Object'.
+ class isJavaArrayClass ifTrue:[
+ class := JavaVM classForName:'java.lang.Object'.
].
"
To resolve an unresolved symbolic reference from D to a method in
@@ -547,7 +568,9 @@
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 ].
+ 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
@@ -564,15 +587,17 @@
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 lookupMethodByNameAndType: aJavaMethodRef nameAndType.
- result ifNil: [ self throwNoSuchMethodError ].
+ result := class lookupMethodByNameAndType:aJavaMethodRef nameAndType.
+ result isNil ifTrue:[
+ self throwNoSuchMethodError
+ ].
(result isAbstract
- and: [ result javaClass isInterface not and: [ class isAbstract not ] ])
- ifTrue: [ self throwAbstractMethodError ].
+ and:[ result javaClass isInterface not and:[ class isAbstract not ] ])
+ ifTrue:[ self throwAbstractMethodError ].
(self
- checkPermissionsForMethod: result
- from: aJavaMethodRef classRef owner
- to: class) ifFalse: [ self throwIllegalAccessError ].
+ 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
@@ -584,7 +609,7 @@
"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 (format): / 01-12-2012 / 13:46:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 09-11-2013 / 00:11:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 04-08-2014 / 15:55:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaResolver methodsFor:'method resolving helpers'!