Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler error when using XmlJavaTypeAdapter annotation #4822

Closed
scabug opened this issue Jul 20, 2011 · 5 comments
Closed

Compiler error when using XmlJavaTypeAdapter annotation #4822

scabug opened this issue Jul 20, 2011 · 5 comments
Assignees

Comments

@scabug
Copy link

scabug commented Jul 20, 2011

Below class example, this cannot be compiled.
getting the following error:

error: type mismatch;
found : java.lang.Classjavax.xml.bind.annotation.adapters.CollapsedStringAdapter
required: java.lang.Class[_ <: javax.xml.bind.annotation.adapters.XmlAdapter]
@XmlJavaTypeAdapter(classOf[CollapsedStringAdapter])

Code example:

import javax.xml.bind.annotation.XmlAttribute
import javax.xml.bind.annotation.adapters.{CollapsedStringAdapter, XmlJavaTypeAdapter}

/**

class TestDto {

@XmlAttribute
@XmlJavaTypeAdapter(classOf[CollapsedStringAdapter])
var id: String = null

}

@scabug
Copy link
Author

scabug commented Jul 20, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4822?orig=1
Reporter: kfir bloch (kfiron)
Affected Versions: 2.9.0
See #3634

@scabug
Copy link
Author

scabug commented Jul 27, 2011

@soc said:
I have looked into that a bit and I assume that this has to do with RawTypes.

The situation is this:

CollapsedStringAdapter extends javax.xml.bind.annotation.adapters.XmlAdapter<String,String>

But the annotation {code}@interface XmlJavaTypeAdapter{code} accepts only {code}Class{code} as a value. I suspect that it would work with {code}Class>{code} or something similar.

@scabug
Copy link
Author

scabug commented Jul 27, 2011

@soc said (edited on Jul 27, 2011 7:19:21 PM UTC):
This is probably related to the problems encountered in #3634.

@scabug
Copy link
Author

scabug commented Jul 27, 2011

Shai Yallin (electricmonk) said:
This problem exists with JDK6, though, Any solution in sight? currently this blocks the usage of Scala "beans" with JAXB, thus preventing integration of Scala modules into legacy systems that use JAXB. However, I assume that there are other frameworks that use this combination of annotation and class type for configuration.

@scabug
Copy link
Author

scabug commented Jul 28, 2011

@paulp said:
Duplicate of #4603.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants