Bug 69812 - Java AST creation error
Summary: Java AST creation error
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0.1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-12 01:06 EDT by Rob Leclerc CLA
Modified: 2004-10-27 06:56 EDT (History)
0 users

See Also:


Attachments
Project file with bug (724.43 KB, application/x-zip-compressed)
2004-07-12 18:50 EDT, Rob Leclerc CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rob Leclerc CLA 2004-07-12 01:06:22 EDT
I keep getting this error. It seems to happen when I try to highlight or 
change the return type in a method. I usually get about 10-15 of these dialog 
boxes popping up one after another. I usually just click escape until it goes 
away. I am including the log file below to help with this. Ocassionally I cant 
get them to all close so I have to kill the app. sorry I cant provide more 
details.

BTW -- despite the problem, this is the best piece of software I have ever 
used/seen you all should be really proud of yourselves.


!ENTRY org.eclipse.core.runtime 4 2 Jul 11, 2004 22:50:22.780
!MESSAGE An internal error occurred during: "Java AST creation".
!STACK 0
java.lang.NullPointerException
	at org.eclipse.jdt.internal.compiler.ast.Assignment.getLastField
(Assignment.java:117)
	at org.eclipse.jdt.internal.compiler.ast.Assignment.checkAssignment
(Assignment.java:61)
	at 
org.eclipse.jdt.internal.compiler.ast.Assignment.resolveTypeExpecting
(Assignment.java:191)
	at org.eclipse.jdt.internal.compiler.ast.AssertStatement.resolve
(AssertStatement.java:123)
	at 
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatemen
ts(AbstractMethodDeclaration.java:395)
	at 
org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration.resolveStatements
(ConstructorDeclaration.java:427)
	at 
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve
(AbstractMethodDeclaration.java:373)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve
(TypeDeclaration.java:920)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve
(TypeDeclaration.java:969)
	at 
org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve
(CompilationUnitDeclaration.java:280)
	at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve
(CompilationUnitResolver.java:436)
	at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve
(CompilationUnitResolver.java:313)
	at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST
(ASTParser.java:657)
	at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:574)
	at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST
(ASTProvider.java:441)
	at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST
(ASTProvider.java:393)
	at 
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartLis
tenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:159)
	at 
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$3.run
(SelectionListenerWithASTManager.java:136)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:66)

!ENTRY org.eclipse.core.runtime 4 2 Jul 11, 2004 22:50:24.563
!MESSAGE An internal error occurred during: "Java AST creation".
!STACK 0
java.lang.NullPointerException
	at org.eclipse.jdt.internal.compiler.ast.Assignment.getLastField
(Assignment.java:117)
	at org.eclipse.jdt.internal.compiler.ast.Assignment.checkAssignment
(Assignment.java:61)
	at 
org.eclipse.jdt.internal.compiler.ast.Assignment.resolveTypeExpecting
(Assignment.java:191)
	at org.eclipse.jdt.internal.compiler.ast.AssertStatement.resolve
(AssertStatement.java:123)
	at 
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatemen
ts(AbstractMethodDeclaration.java:395)
	at 
org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration.resolveStatements
(ConstructorDeclaration.java:427)
	at 
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve
(AbstractMethodDeclaration.java:373)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve
(TypeDeclaration.java:920)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve
(TypeDeclaration.java:969)
	at 
org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve
(CompilationUnitDeclaration.java:280)
	at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve
(CompilationUnitResolver.java:436)
	at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve
(CompilationUnitResolver.java:313)
	at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST
(ASTParser.java:657)
	at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:574)
	at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST
(ASTProvider.java:441)
	at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST
(ASTProvider.java:393)
	at 
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartLis
tenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:159)
	at 
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$3.run
(SelectionListenerWithASTManager.java:136)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:66)

!ENTRY org.eclipse.core.runtime 4 2 Jul 11, 2004 22:50:26.686
!MESSAGE An internal error occurred during: "Java AST creation".
!STACK 0
java.lang.NullPointerException
	at org.eclipse.jdt.internal.compiler.ast.Assignment.getLastField
(Assignment.java:117)
	at org.eclipse.jdt.internal.compiler.ast.Assignment.checkAssignment
(Assignment.java:61)
	at 
org.eclipse.jdt.internal.compiler.ast.Assignment.resolveTypeExpecting
(Assignment.java:191)
	at org.eclipse.jdt.internal.compiler.ast.AssertStatement.resolve
(AssertStatement.java:123)
	at 
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatemen
ts(AbstractMethodDeclaration.java:395)
	at 
org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration.resolveStatements
(ConstructorDeclaration.java:427)
	at 
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve
(AbstractMethodDeclaration.java:373)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve
(TypeDeclaration.java:920)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve
(TypeDeclaration.java:969)
	at 
org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve
(CompilationUnitDeclaration.java:280)
	at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve
(CompilationUnitResolver.java:436)
	at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve
(CompilationUnitResolver.java:313)
	at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST
(ASTParser.java:657)
	at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:574)
	at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST
(ASTProvider.java:441)
	at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST
(ASTProvider.java:393)
	at 
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartLis
tenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:159)
	at 
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$3.run
(SelectionListenerWithASTManager.java:136)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:66)
Comment 1 Olivier Thomann CLA 2004-07-12 12:48:14 EDT
Could you please attach the source file you are editing and let us know what
method you are changing?
This could help us tracking this down.
Are you using a plain Eclipse 3.0 drop? or do you have cheetah installed?
Comment 2 Rob Leclerc CLA 2004-07-12 14:56:24 EDT
Here are the source files. When I click next to "Object" in the newInstance() 
field the error dialog pops. Note that this is just one place where this 
occurs. I will try to pay better attention to when this is occuring so that 
this might be narrowed down. If you need, I can zip the entire project for you 
and send it to you.

I am including the Abstract class Gene.java, Factory.java, and 
HopfieldGene.java

/*
 * Created on Jun 9, 2004
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package yale.cyberzoan.genetics;

import yale.utils.Factory;

import java.io.Serializable;
import java.util.List;

/**
 * @author rdl25
 * 
 * To change the template for this generated type comment go to Window -
 * Preferences - Java - Code Generation - Code and Comments
 */
public abstract class Gene implements Serializable, Mutatable, Factory {
	public ProteinFunction function = null;

	public ProteinStructure protein = null;

	public List cisRegulators = null;

	public int geneIndex;

	public Gene() {
	}

	public abstract void initRandom(int regs);

	//kept for serialization purposes
	public ProteinFunction getFunction() {
		return function;
	}

	public ProteinStructure getProtein() {
		return protein;
	}

	public void setProtein(ProteinStructure protein) {
		this.protein = (ProteinStructure) protein;
	}

	public final List getCisRegulators() {
		return cisRegulators;
	}

	public void setCisRegulators(List regulators) {
		cisRegulators = regulators;
	}

	public int getGeneIndex() {
		return geneIndex;
	}

	public void setGeneIndex(int geneIndex) {
		this.geneIndex = geneIndex;
	}
}


/*
 * Created on Jun 23, 2004
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package yale.utils;

/**
 * @author rdl25
 * 
 * To change the template for this generated type comment go to Window -
 * Preferences - Java - Code Generation - Code and Comments
 */
public interface Factory {
	Object newInstance();
}



/*
 * Created on Jun 9, 2004
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package yale.cyberzoan.genetics.genes.leclerc.hopfield;

import yale.cyberzoan.genetics.*;
import yale.math.MyRandom;

import yale.utils.StringUtils;

import java.util.Iterator;
import java.util.LinkedList;

/**
 * @author rdl25
 * 
 * To change the template for this generated type comment go to Window -
 * Preferences - Java - Code Generation - Code and Comments
 */
public class HopfieldGene extends Gene {
	public final static int I_PROTEIN_SIZE = 3;

	public final static int I_OUTPUT_SIZE = 2;

	public final static int I_MIDDLE_LAYER_SIZE = 3;

	public final static int I_UPDATE_ITERATIONS = 2;

	public final static double D_RANGE_SCALAR = 0.05d;

	public HopfieldGene() {
	}

	public int getNumFields() {
		return protein.getNumFields() + cisRegulators.size()
				* ((ProteinBindingSite) cisRegulators.get
(0)).getNumFields()
				+ function.getNumFields();
	}

	public void mutate() {

		int cisFields = cisRegulators.size()
				* ((ProteinBindingSite) cisRegulators.get
(0)).getNumFields();
		int proteinFields = cisFields + protein.getNumFields();
		int functionFields = proteinFields + function.getNumFields();
		int random = MyRandom.getIntEXCL(proteinFields);

		if (random < cisFields) {
			ProteinBindingSite ce = (ProteinBindingSite) 
cisRegulators
					.get(MyRandom.getIntEXCL
(cisRegulators.size()));
			ce.mutate();
		} else if (random < proteinFields)
			protein.mutate();
		else if (random < functionFields)
			assert false : "shouldn't be getting here yet";
		else
			throw new RuntimeException("Invalid selection");

	}

	public void initRandom() {
		initRandom(3);
	}

	public void initRandom(int regs) {
		cisRegulators = new LinkedList();
		protein = new HopfieldProteinStructure();
		function = new HopfieldProteinFunction();
		protein.initRandom();
		function.initRandom();
		for (int i = 0; i < regs; i++) {
			HopfieldProteinBindingSite ce = new 
HopfieldProteinBindingSite();
			ce.initRandom();
			cisRegulators.add(ce);
		}
	}

	public String toString() {
		String s = "Gene@" + StringUtils.formatedInt(this.hashCode(), 
4)
				+ "[Cis:{";
		int i = 0;
		for (Iterator iter = cisRegulators.iterator(); iter.hasNext
();) {
			//HopfieldProteinBindingSite element = 
(HopfieldProteinBindingSite)
			// iter.next();
			s += "#" + i + iter.next() + ", ";
		}
		s = s.substring(0, s.length() - 2);
		s += "Prot:" + protein.toString() + "\n";
		s += "Func:" + function.toString() + "]";
		return s;
	}

	public Object newInstance() {
		return new HopfieldGene();
	}
}
Comment 3 Olivier Thomann CLA 2004-07-12 16:46:21 EDT
If the whole project is not too big, sure attach it to the PR. Otherwise I will
start to investigate with your example.
Please create an attachment to submit source files. It prevents the source from
being reformatted by bugzilla.
Thanks.
Comment 4 Rob Leclerc CLA 2004-07-12 18:50:30 EDT
Created attachment 13188 [details]
Project file with bug

This project file should give you all the important dependancies to recreate
the bug. 

(Click your mouse where the astrix is (see below) in the Cell.java file)
public Product* newInstance(){
	return (Product)(new Cell());
}

I notice that only when I click somewhere else in the editor window that I can
stop the stream of popups.
Comment 5 Olivier Thomann CLA 2004-07-22 11:24:10 EDT
Could you please let me know what libraries I need to get in order to compile
your example?
I tried to create a Java project with the attached project, but I get lot of
compile errors for missing files.
Thanks.
Comment 6 Rob Leclerc CLA 2004-07-26 14:10:14 EDT
I have reinstalled a new version of eclipse and I don't *seem* to be getting 
the error anymore. That said, i will let you know if this comes up again at 
some point and send you what I have.

I take it then that you wern't getting the error on the uncompiled code that I 
did send?
Comment 7 Olivier Thomann CLA 2004-07-26 14:40:42 EDT
Close as WORKSFORME. Please reopen if you get it again.