Monday, 1 September 2008
Java semantics
« Lambda, the ultimate procrastination | Main | Whoops »As part of learning Scala, I have recently gone back and looked at Java semantics. I am amazed at how complicated things have become. I seem to recall that at the time that I first learned Java, there was:
- java.lang.Object
- java.lang.Class
and some ugly runts called primitives (byte, short, int, long, float, double, boolean, char) which had big brother equivalents. Objects had fields, methods, and contstructors. Any of these could be public, private, or protected. Fields and methods could be static. There was some syntax for dealing with:
- java.lang.reflect.Array
In fact, the situation was more complicated that this but to write a program that would generate stubs of a class file, the above was sufficient.
Today matters are more complicated. java.lang.Class is now a typed (java.lang.class<T>) and implements:
- java.lang.reflect.Type
- java.lang.reflect.AnnotatedElement
- java.lang.reflect.GenericDeclaration
Type has four subinterfaces
- java.lang.reflect.GenericArrayType
- java.lang.reflect.ParameterizedTypee
- java.lang.reflect.TypeVariable<D extends GenericDeclaration>
- java.lang.reflect.WildcardType
There is syntactic sugar both for enumerations (which have the initially confusing declaration ENUM<E extends Enum<E>>) and for java.lang.annotation.Annotation which has implementing classes
- BindingType
- ConstructorProperties
- Deprecated
- DescriptorKey
- Documented
- Generated
- HandlerChain
- Inherited
- InitParam
- MXBean
- Oneway
- Override
- PostConstruct
- PreDestroy
- RequestWrapper
- Resource
- Resources
- ResponseWrapper
- Retention
- ServiceMode
- SOAPBinding
- SOAPMessageHandler
- SOAPMessageHandlers
- SupportedAnnotationTypes
- SupportedOptions
- SupportedSourceVersion
- SuppressWarnings
- Target
- WebEndpoint
- WebFault
- WebMethod
- WebParam
- WebResult
- WebService
- WebServiceClient
- WebServiceProvider
- WebServiceRef
- WebServiceRefs
- XmlAccessorOrder
- XmlAccessorType
- XmlAnyAttribute
- XmlAnyElement
- XmlAttachmentRef
- XmlAttribute
- XmlElement
- XmlElementDecl
- XmlElementRef
- XmlElementRefs
- XmlElements
- XmlElementWrapper
- XmlEnum
- XmlEnumValue
- XmlID
- XmlIDREF
- XmlInlineBinaryData
- XmlJavaTypeAdapter
- XmlJavaTypeAdapters
- XmlList
- XmlMimeType
- XmlMixed
- XmlNs
- XmlRegistry
- XmlRootElement
- XmlSchema
- XmlSchemaType
- XmlSchemaTypes
- XmlTransient
- XmlType
- XmlValue
Oh my.
[Trackback URL for this entry]
