Results 1 to 6 of 6
  1. #1
    bayan is offline Member
    Join Date
    Apr 2010
    Posts
    55
    Rep Power
    0

    Default Incompatible types

    Java Code:
    org.apache.bcel.classfile.Method method = jclass.getMethod(jclass.getMethods()[root.getIndex(theNode)]);
    For some reason I get an incompatible types error when I compile this code

    required: java.lang.reflect.Method
    found: org.apache.bcel.classfile.method

    Any help much appreciated.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,658
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by bayan View Post
    Java Code:
    org.apache.bcel.classfile.Method method = jclass.getMethod(jclass.getMethods()[root.getIndex(theNode)]);
    For some reason I get an incompatible types error when I compile this code

    required: java.lang.reflect.Method
    found: org.apache.bcel.classfile.method

    Any help much appreciated.
    Do as the compiler says?

    Java Code:
    java.lang.reflect.Method method = jclass.getMethod(jclass.getMethods()[root.getIndex(theNode)]);
    kind regards,

    Jos

  3. #3
    bayan is offline Member
    Join Date
    Apr 2010
    Posts
    55
    Rep Power
    0

    Default

    But an org.apache.bcel.classfile.Method is supposed to be returned since it's the bcel api i'm working with.

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,658
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by bayan View Post
    But an org.apache.bcel.classfile.Method is supposed to be returned since it's the bcel api i'm working with.
    The compiler figured out that the jclass.getMethod( ... ) call returns a java.lang.reflect.Method obect; I can't tell you anything else without knowing a bit more context.

    kind regards,

    Jos

  5. #5
    bayan is offline Member
    Join Date
    Apr 2010
    Posts
    55
    Rep Power
    0

    Default

    Tried that. Strange still same error

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,097
    Rep Power
    20

    Default

    What is jclass?
    What is the signature of its getMethod() method?

Similar Threads

  1. incompatible types error
    By magic in forum New To Java
    Replies: 3
    Last Post: 06-02-2010, 04:58 PM
  2. Incompatible operand types int and double[][]
    By Haske2r in forum New To Java
    Replies: 2
    Last Post: 01-21-2010, 05:26 PM
  3. Incompatible types
    By coltragon in forum New To Java
    Replies: 5
    Last Post: 01-15-2010, 04:47 PM
  4. Replies: 3
    Last Post: 12-14-2008, 01:52 PM
  5. problem with scanner class:incompatible types
    By fred in forum New To Java
    Replies: 1
    Last Post: 07-20-2007, 07:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •