Hello,
It would be nice if the generated code could be clean up a bit. It would
avoid so many compiler warnings I am now getting.
(I might have brought this up before but we have been cleaning up our code
and more warnings have been showing in JAXB generated code since we have
turned on more warning types in eclipse.)
For example, Eclipse reports the following.
(I) In the generated "runtime":
(1)
Severity Description Resource In Folder Location
Creation Time
Superfluous semicolon NamespaceContextImpl.java
Transidiom-DevE/Java/Source/com/seagullsw/toolbox/xml/jaxb/impl/runtime line
169 July 23, 2003 11:24:29 AM
Which is:
if( existingUri.length()==0 ) {
// we have to remap the new namespace URI to a different
// prefix because the current association of ""->""
cannot
// be changed
; <<<<<< Superfluous semicolon
} else {
(2)
Severity Description Resource In Folder Location
Creation Time
Superfluous semicolon SAXMarshaller.java
Transidiom-DevE/Java/Source/com/seagullsw/toolbox/xml/jaxb/impl/runtime line
86 July 23, 2003 11:24:29 AM
Which is:
/** Element name stack implemented as an array of (uri,local) pairs. */
private String[] elementStack = new String[16];; <<<<<< Superfluous
semicolon
(3)
Severity Description Resource In Folder Location
Creation Time
Superfluous semicolon ValidatorImpl.java
Transidiom-DevE/Java/Source/com/seagullsw/toolbox/xml/jaxb/impl/runtime line
81 July 23, 2003 11:24:29 AM
Which is:
private static class EventInterceptor implements ValidationEventHandler
{
<snip>
}; <<<<<< Superfluous semicolon
Also:
Severity Description Resource In Folder Location
Creation Time
The private method _assert(boolean, String) from the type
UnmarshallerImpl is never used locally UnmarshallerImpl.java
Transidiom-DevE/Java/Source/com/seagullsw/toolbox/xml/jaxb/impl/runtime line
181 July 23, 2003 11:24:29 AM
Severity Description Resource In Folder Location
Creation Time
Read access to enclosing field SAXMarshaller.writer is emulated by a
synthetic accessor method. Increasing its visibility will improve your
performance SAXMarshaller.java
Transidiom-DevE/Java/Source/com/seagullsw/toolbox/xml/jaxb/impl/runtime line
134 July 23, 2003 11:24:29 AM
Read access to enclosing field SAXMarshaller.writer is emulated by a
synthetic accessor method. Increasing its visibility will improve your
performance SAXMarshaller.java
Transidiom-DevE/Java/Source/com/seagullsw/toolbox/xml/jaxb/impl/runtime line
139 July 23, 2003 11:24:29 AM
(II) Other code
The non-"runtime" code generated also contains plenty of warnings. The
warnings fall in the following categories:
(1) Unnecessary cast to type String for expression of type String
Severity Description Resource In Folder Location
Creation Time
Unnecessary cast to type String for expression of type String
ConfigurationTypeImpl.java
Transidiom-DevE/Java/Source/com/seagullsw/toolbox/config/bind/impl line
143 July 23, 2003 11:24:31 AM
For example:
public void
serializeElementBody(com.seagullsw.toolbox.xml.jaxb.impl.runtime.XMLSerializ
er context)
throws org.xml.sax.SAXException
{
int idx5 = 0;
final int len5 = _Property.size();
if (_Description!= null) {
context.startElement("", "description");
context.endNamespaceDecls();
context.endAttributes();
try {
context.text(((java.lang.String) _Description)); <<<<<<<<<<
(2) The local variable len5 is never read
Severity Description Resource In Folder Location
Creation Time
The local variable len5 is never read ConfigurationTypeImpl.java
Transidiom-DevE/Java/Source/com/seagullsw/toolbox/config/bind/impl line
181 July 23, 2003 11:24:31 AM
Severity Description Resource In Folder Location
Creation Time
Unnecessary cast to type float for expression of type float
ConfigurationTypeImpl.java
Transidiom-DevE/Java/Source/com/seagullsw/toolbox/config/bind/impl line
184 July 23, 2003 11:24:31 AM
For example:
public void
serializeAttributes(com.seagullsw.toolbox.xml.jaxb.impl.runtime.XMLSerialize
r context)
throws org.xml.sax.SAXException
{
int idx5 = 0;
final int len5 = _Property.size(); <<<<<<<
context.startAttribute("", "version");
try {
context.text(javax.xml.bind.DatatypeConverter.printFloat(((float)
VERSION))); <<<<<<<
(3) Read access to enclosing field ObjectFactory.defaultImplementations is
emulated by a synthetic accessor method. Increasing its visibility will
improve your performance
Severity Description Resource In Folder Location
Creation Time
Read access to enclosing field ObjectFactory.defaultImplementations
is emulated by a synthetic accessor method. Increasing its visibility will
improve your performance ObjectFactory.java
Transidiom-DevE/Java/Source/com/seagullsw/toolbox/config/bind line 169
July 23, 2003 11:24:31 AM
(4) The local variable attIdx is never read
Severity Description Resource In Folder Location
Creation Time
The local variable attIdx is never read ConfigurationTypeImpl.java
Transidiom-DevE/Java/Source/com/seagullsw/toolbox/config/bind/impl line
565 July 23, 2003 11:24:31 AM
For example:
public void enterAttribute(java.lang.String ___uri, java.lang.String
___local, java.lang.String ___qname)
throws org.xml.sax.SAXException
{
int attIdx;
Thanks,
Gary