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

Reflective access to parametrized type info not available #1395

Closed
scabug opened this issue Oct 1, 2008 · 4 comments
Closed

Reflective access to parametrized type info not available #1395

scabug opened this issue Oct 1, 2008 · 4 comments
Assignees

Comments

@scabug
Copy link

scabug commented Oct 1, 2008

import java.lang.reflect._

/*
 * Version: Scala 2.7.2-RC2
 * Prints: Parameterized type info not available
 */
object GenTypeTest extends Application {
  val f = classOf[foo].getDeclaredField("l")
  val gtype = f.getGenericType
  if (gtype.isInstanceOf[ParameterizedType]) {
    val typeArgs = gtype.asInstanceOf[ParameterizedType].getActualTypeArguments
    println("type args " + typeArgs)
  } else {
    println("Parameterized type info not available");
  }
}

class foo {
  val l: List[Int] = null
}
@scabug
Copy link
Author

scabug commented Oct 1, 2008

Imported From: https://issues.scala-lang.org/browse/SI-1395?orig=1
Reporter: Joni Freeman (inhuman)

@scabug
Copy link
Author

scabug commented Oct 29, 2008

Derek (dereki) said:
This is stopping us using Jersey https://jersey.dev.java.net/ @context provider functionality.
We will work around this by using Java to wrap for the moment.

@scabug
Copy link
Author

scabug commented Mar 23, 2009

Rob (rbygrave) said:
In my opinion this is an important bug for using ORM frameworks - so I'm wondering why it has not been fixed?

That is, ORM frameworks will use reflection on properties/fields to determine the parameter type.

Using ASM bytecode outline it seems that the Scala compiler is leaving off the generics parameter type in the field definition. I'm not sure how that translates to the scala compiler.

@scabug
Copy link
Author

scabug commented Mar 24, 2009

@dragos said:
Scalac should generate java signatures for private members now (r17376).

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

No branches or pull requests

2 participants