Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.6.4, 1.7-beta-1
-
None
-
Windows XP, Java 1.6
Description
I compile GroovyBean with @Bindable and/or @Vetoable annotations to Java bytecode. I want to use this class in a Java application. But when I compile the Java class I get the following error:
CarApp.java:11: cannot find symbol symbol : method addPropertyChangeListener(<anonymous java.beans.PropertyChangeListener>) location: class CarBean car.addPropertyChangeListener(new java.beans.PropertyChangeListener() { ^
The strange thing is that when I look with javap in the generated Groovy class I see the method is available.
Groovy class:
import groovy.beans.* class Car { int numberOfDoors @Vetoable String model @Vetoable String brand boolean automatic @Bindable double price String toString() { "[Car details => brand: '${brand}', model: '${model}', #doors: '${numberOfDoors}', automatic: '${automatic}', price: '${price}']" } }
Java class:
import java.beans.*; public class CarApp { public static void main(String[] args) throws Exception { Car car = new Car(); car.setNumberOfDoors(3); car.setModel("A3"); car.setBrand("AUDI"); car.setPrice(32010); car.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent evt) { System.out.println(evt); } }); } }