JavaDescriptor.st
author Claus Gittinger <cg@exept.de>
Thu, 24 Nov 2011 11:46:54 +0100
changeset 2185 46dc2f10fb76
parent 2152 1cbdfbcc685c
child 2308 5355d2734b8e
permissions -rw-r--r--
added: #version_CVS
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     1
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     2
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     3
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     4
                            SWING Research Group, Czech Technical University in Prague
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     5
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     6
 Parts of the code written by Claus Gittinger are under following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     7
 license:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     8
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     9
 This software is furnished under a license and may be used
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    10
 only in accordance with the terms of that license and with the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    11
 inclusion of the above copyright notice.   This software may not
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    12
 be provided or otherwise made available to, or used by, any
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    13
 other person.  No title to or ownership of the software is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    14
 hereby transferred.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    15
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    16
 Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    17
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    18
 Permission is hereby granted, free of charge, to any person
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    19
 obtaining a copy of this software and associated documentation
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    20
 files (the 'Software'), to deal in the Software without
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    21
 restriction, including without limitation the rights to use,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    22
 copy, modify, merge, publish, distribute, sublicense, and/or sell
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    23
 copies of the Software, and to permit persons to whom the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    24
 Software is furnished to do so, subject to the following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    25
 conditions:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    26
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    27
 The above copyright notice and this permission notice shall be
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    28
 included in all copies or substantial portions of the Software.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    29
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    30
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    31
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    32
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    33
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    34
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    35
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    36
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    37
 OTHER DEALINGS IN THE SOFTWARE.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    38
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    39
 [1] Code written at SWING Research Group contain a signature
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    40
     of one of the above copright owners.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    41
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    42
"{ Package: 'stx:libjava' }"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    43
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    44
Object subclass:#JavaDescriptor
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    45
	instanceVariableNames:''
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    46
	classVariableNames:'BaseTypes BaseTypesByTypeName ArrayTypes'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    47
	poolDictionaries:''
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    48
	category:'Languages-Java-Support'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    49
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    50
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    51
!JavaDescriptor class methodsFor:'documentation'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    52
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    53
copyright
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    54
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    55
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    56
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    57
                            SWING Research Group, Czech Technical University in Prague
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    58
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    59
 Parts of the code written by Claus Gittinger are under following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    60
 license:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    61
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    62
 This software is furnished under a license and may be used
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    63
 only in accordance with the terms of that license and with the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    64
 inclusion of the above copyright notice.   This software may not
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    65
 be provided or otherwise made available to, or used by, any
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    66
 other person.  No title to or ownership of the software is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    67
 hereby transferred.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    68
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    69
 Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    70
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    71
 Permission is hereby granted, free of charge, to any person
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    72
 obtaining a copy of this software and associated documentation
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    73
 files (the 'Software'), to deal in the Software without
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    74
 restriction, including without limitation the rights to use,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    75
 copy, modify, merge, publish, distribute, sublicense, and/or sell
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    76
 copies of the Software, and to permit persons to whom the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    77
 Software is furnished to do so, subject to the following
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    78
 conditions:
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    79
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    80
 The above copyright notice and this permission notice shall be
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    81
 included in all copies or substantial portions of the Software.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    82
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    83
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    84
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    85
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    86
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    87
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    88
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    89
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    90
 OTHER DEALINGS IN THE SOFTWARE.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    91
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    92
 [1] Code written at SWING Research Group contain a signature
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    93
     of one of the above copright owners.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    94
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    95
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    96
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    97
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    98
!JavaDescriptor class methodsFor:'instance creation'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    99
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   100
fromString: aString
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   101
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   102
    ^self readFromString: aString
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   103
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   104
    "Created: / 25-11-2010 / 18:20:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   105
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   106
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   107
readFrom: aStream
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   108
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   109
    ^ self
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   110
        readFrom:aStream
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   111
        onError:[ self conversionErrorSignal
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   112
                    raiseErrorString:'invalid java descriptor']
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   113
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   114
    "Created: / 25-11-2010 / 18:04:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   115
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   116
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   117
readFrom:stream onError:exceptionBlock
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   118
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   119
    (stream peek == $( or:[stream peek == $<])
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   120
        ifTrue: [^self readMethodDescriptorFrom: stream onError: exceptionBlock]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   121
        ifFalse:[^self readFieldDescriptorFrom:  stream onError: exceptionBlock].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   122
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   123
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   124
        JavaDescriptor fromString:'Ljava/lang/Object;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   125
        JavaDescriptor fromString:'[I'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   126
        JavaDescriptor fromString:'[[I'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   127
        JavaDescriptor fromString:'(ILjava/lang/Object;)V'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   128
        JavaDescriptor fromString:'(ILjava/lang/Object;)Ljava/lang/Class;'    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   129
        JavaDescriptor fromString:'<T:Ljava/lang/Object;>(Ljava/util/Collection<TT;>;I)Ljava/util/Collection<TT;>;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   130
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   131
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   132
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   133
    "Created: / 25-11-2010 / 17:50:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   134
    "Modified: / 13-08-2011 / 01:37:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   135
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   136
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   137
!JavaDescriptor class methodsFor:'accessing'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   138
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   139
baseTypes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   140
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   141
    ^BaseTypes
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   142
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   143
    "Created: / 22-05-2011 / 17:45:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   144
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   145
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   146
baseTypesByTypeName
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   147
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   148
    ^BaseTypesByTypeName
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   149
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   150
    "Created: / 03-02-2011 / 21:08:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   151
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   152
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   153
!JavaDescriptor class methodsFor:'class initialization'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   154
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   155
initialize
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   156
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   157
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   158
    Tools::NewSystemBrowser basicNew spawnClassBrowserFor: BaseTypes values label:'Java primitive types' in:#newBrowser       
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   159
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   160
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   161
    "/WARNING: If you change something here, you MUST also
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   162
    "/         change JavaField class>>#initialize !!!!!!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   163
    BaseTypes := IdentityDictionary new
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   164
        at: $B  put: Byte;
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   165
        at: $C  put: Character;
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   166
        at: $D  put: Float;
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   167
        at: $F  put: ShortFloat;
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   168
        at: $I  put: Integer;       "Kludge: instances of java int are in fact SmallIntegers"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   169
        at: $J  put: LargeInteger;
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   170
        at: $S  put: Short;
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   171
        at: $Z  put: Boolean;
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   172
        at: $V  put: UndefinedObject;
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   173
        yourself.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   174
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   175
    BaseTypesByTypeName := Dictionary new
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   176
        at: 'byte'      put: Byte;
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   177
        at: 'char'      put: Character;
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   178
        at: 'double'    put: Float;
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   179
        at: 'float'     put: ShortFloat;
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   180
        at: 'int'       put: Integer;       "Kludge: instances of java int are in fact SmallIntegers"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   181
        at: 'long'      put: LargeInteger;
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   182
        at: 'short'     put: Short;
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   183
        at: 'boolean'   put: Boolean;
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   184
        at: 'void'      put: UndefinedObject;
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   185
        yourself.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   186
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   187
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   188
    Tools::NewSystemBrowser basicNew spawnClassBrowserFor: ArrayTypes values label:'Java primitive array types' in:#newBrowser       
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   189
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   190
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   191
    "/WARNING: If you change something here, you MUST also
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   192
    "/         change JavaField class>>#initialize !!!!!!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   193
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   194
    ArrayTypes := IdentityDictionary new
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   195
        at: $B  put: ByteArray;
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   196
        at: $C  put: Unicode16String;
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   197
        at: $D  put: DoubleArray;
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   198
        at: $F  put: FloatArray;
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   199
        at: $I  put: SignedIntegerArray;    
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   200
        at: $J  put: SignedLongIntegerArray;
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   201
        at: $S  put: WordArray;
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   202
        at: $Z  put: BooleanArray;
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   203
        yourself
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   204
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   205
    "Created: / 25-11-2010 / 17:51:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   206
    "Modified: / 10-08-2011 / 00:48:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   207
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   208
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   209
!JavaDescriptor class methodsFor:'reading-private'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   210
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   211
readArrayTypeFrom:  stream onError: exceptionBlock
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   212
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   213
    | p c |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   214
    stream next. "eat $["
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   215
    p := stream peek.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   216
    (#(
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   217
         $B "byte"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   218
         $C "char"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   219
         $D "double"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   220
         $F "float"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   221
         $I "int"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   222
         $J "long"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   223
         $S "short"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   224
         $Z "boolean"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   225
    ) includes: p) ifTrue:[^JavaFieldDescriptor javaClass: (ArrayTypes at: stream next)].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   226
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   227
    "OK, not a primitive array..."
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   228
    c := self readFrom: stream onError: exceptionBlock.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   229
    ^JavaFieldDescriptor javaClass: (JavaVM javaArrayClassFor: c javaClass)
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   230
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   231
    "Created: / 25-11-2010 / 18:12:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   232
    "Modified: / 06-02-2011 / 23:15:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   233
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   234
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   235
readBaseTypeFrom:  stream onError: exceptionBlock
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   236
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   237
    ^JavaFieldDescriptor javaClass: (BaseTypes at: (stream next) ifAbsent: exceptionBlock)
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   238
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   239
    "Created: / 25-11-2010 / 18:11:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   240
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   241
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   242
readFieldDescriptorFrom:  stream onError: exceptionBlock
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   243
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   244
    | p |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   245
    p := stream peek.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   246
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   247
    p == $L ifTrue:[^self readObjectTypeFrom: stream onError: exceptionBlock].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   248
    p == $[ ifTrue:[^self readArrayTypeFrom: stream onError: exceptionBlock].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   249
    (#(
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   250
         $B "byte"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   251
         $C "char"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   252
         $D "double"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   253
         $F "float"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   254
         $I "int"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   255
         $J "long"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   256
         $S "short"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   257
         $Z "boolean"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   258
         $V "void"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   259
    ) includes: p) ifTrue:[^self readBaseTypeFrom: stream onError: exceptionBlock].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   260
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   261
    exceptionBlock value
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   262
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   263
    "Created: / 25-11-2010 / 17:55:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   264
    "Modified: / 21-12-2010 / 22:47:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   265
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   266
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   267
readMethodDescriptorFrom: stream onError: exceptionBlock
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   268
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   269
    | parameterDescriptors returnDescriptor |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   270
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   271
    stream peek == $< ifTrue:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   272
        self readTypeVariableFrom: stream onError: exceptionBlock
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   273
    ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   274
    stream next. "eat $("
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   275
    parameterDescriptors := OrderedCollection new.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   276
    [ stream peek ~= $) ] whileTrue:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   277
        parameterDescriptors add:( self readFieldDescriptorFrom: stream onError: exceptionBlock).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   278
    ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   279
    stream next. "eat $)"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   280
    stream peek == $V ifFalse:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   281
        returnDescriptor := self readFieldDescriptorFrom: stream onError: exceptionBlock.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   282
    ] ifTrue:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   283
        stream next. "eat $V"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   284
    ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   285
    ^JavaMethodDescriptor parameters: parameterDescriptors return: returnDescriptor
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   286
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   287
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   288
        JavaDescriptor fromString:'(ILjava/lang/Object;)V'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   289
        JavaDescriptor fromString:'(ILjava/lang/Object;)Ljava/lang/Class;'  
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   290
    "
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   291
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   292
    "Created: / 25-11-2010 / 18:36:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   293
    "Modified: / 13-08-2011 / 01:39:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   294
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   295
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   296
readObjectTypeFrom:  stream onError: exceptionBlock
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   297
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   298
    | clsName out |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   299
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   300
    stream next. "/eat $L.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   301
    out := String new writeStream.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   302
    [ stream peek ~~ $; and:[stream peek ~~ $< ]] whileTrue:[out nextPut: stream next].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   303
    clsName := out contents.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   304
    stream peek == $< ifTrue:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   305
        self readTypeVariableFrom: stream onError: exceptionBlock
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   306
    ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   307
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   308
    "Just a check"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   309
    stream next ~= $; ifTrue:[exceptionBlock value].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   310
    ^JavaFieldDescriptor javaClassName: clsName.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   311
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   312
    "Created: / 25-11-2010 / 18:08:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   313
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   314
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   315
readTypeVariableFrom:  stream onError: exceptionBlock
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   316
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   317
    | nangles |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   318
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   319
    stream next. "/eat $<.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   320
    nangles := 1.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   321
    [ nangles ~~ 0 ] whileTrue:[
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   322
        stream peek == $< ifTrue:[nangles := nangles + 1].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   323
        stream peek == $> ifTrue:[nangles := nangles - 1].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   324
        stream next.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   325
    ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   326
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   327
    "Created: / 13-08-2011 / 01:39:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   328
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   329
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   330
!JavaDescriptor class methodsFor:'documentation'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   331
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   332
version_SVN
2152
1cbdfbcc685c Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 749
diff changeset
   333
    ^ '$Id: JavaDescriptor.st,v 1.1 2011-08-18 19:06:53 vrany Exp $'
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   334
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   335
2152
1cbdfbcc685c Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 749
diff changeset
   336
JavaDescriptor initialize!