audriusrudalevicius / evolutionchamber

Automatically exported from code.google.com/p/evolutionchamber
0 stars 0 forks source link

java.lang.RuntimeException: Uncompilable source code - clone() in org.jgap.util.ICloneable is defined in an inaccessible class or interface #87

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run Netbeans
2. Import the project from the eclipse project file
3. Run the application / or see the error reports

What is the expected output? What do you see instead?
I expect the application to run correctly.
From time to time the following exception is reported.
The following line is marked in Netbeans with the same warning:
IChromosome chromosome = (IChromosome) arg0.getChromosome(i)).clone();

I don't know if it's a Netbeans problem or something it caught and Eclipse 
missed. Just putting it out so maybe a person with more kwnoledge about Java 
can dissmiss or confirm it.

Exception in thread "Thread-4" java.lang.RuntimeException: Uncompilable source 
code - clone() in org.jgap.util.ICloneable is defined in an inaccessible class 
or interface
        at com.fray.evo.EcGeneticUtil$4.operate(EcGeneticUtil.java:121)
        at org.jgap.BreederBase.applyGeneticOperators(BreederBase.java:109)
        at org.jgap.impl.GABreeder.evolve(GABreeder.java:86)
        at org.jgap.Genotype.evolve(Genotype.java:225)
        at org.jgap.Genotype.run(Genotype.java:594)
        at java.lang.Thread.run(Thread.java:662)

I'm running Netbeans 6.9.1 I have the following java jre/jdks installed:
jdk1.6.0_22
jre1.6.0_02
jre6

I believe Netbeans is using the jdk.

Tested on r65 of EC.

Original issue reported on code.google.com by netpr...@gmail.com on 26 Oct 2010 at 9:25

GoogleCodeExporter commented 8 years ago
Th error is triggered in the following line (EcGeneticUtil.java:121):
    IChromosome chromosome = (IChromosome) arg0.getChromosome(i).clone();

It tries to execute clone() method defined in ICloneable interface which is 
package protected for some reason. Since you are calling it from a different 
package you are getting the exception. It is unclear why you did not get the 
error on different environments.

Try to cast returned value to Cloneable before calling the clone() method.

Original comment by sergey...@gmail.com on 26 Oct 2010 at 11:00

GoogleCodeExporter commented 8 years ago
Fixed in r66

Original comment by netpr...@gmail.com on 27 Oct 2010 at 6:19