Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » java snippet editor imports broken?(The method setName(String) is undefined for the type Person)
java snippet editor imports broken? [message #727904] Thu, 22 September 2011 07:48 Go to next message
Mike Turner is currently offline Mike TurnerFriend
Messages: 8
Registered: September 2011
Junior Member
Hi,

I'm getting to grips with the Eclipse/Java "total beginners tutorial" and on lesson 3 I'm finding that the operation of Eclipse deviates from the video.

I have (apparently) successfully set the imports for myScrapbook.jpage to org.totalbeginner.tutorial.* and when I put the period after the p I do get a selection box including the four methods that were defined in the prior lesson. But when I attempt to inspect p, this is what I get :-

The method setName(String) is undefined for the type Person
The method setMaximumBooks(int) is undefined for the type Person
Person p = new Person();
p.setName("Fred");
p.setMaximumBooks(3);
p

This is with Eclipde 3.7 downloaded and installed this week on WinXP.

This is a showstopper. All help appreciated!

Mike


Re: java snippet editor imports broken? [message #728359 is a reply to message #727904] Fri, 23 September 2011 05:59 Go to previous messageGo to next message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
Imports in java snippet editor works for me. Do you have another 'Person' class in that project?
Re: java snippet editor imports broken? [message #728374 is a reply to message #728359] Fri, 23 September 2011 06:57 Go to previous messageGo to next message
Mike Turner is currently offline Mike TurnerFriend
Messages: 8
Registered: September 2011
Junior Member
I do not - but I have spotted something that seems very relevant, if inexplicable.

Here's the class :-

package org.totalbeginner.tutorial;

public class Person {
// fields
private String name; // name of the person
private int maximumBooks; //most books the person can check out

//constructors
public Person() {
name = "unknown name";
maximumBooks = 3;
}

// methods
public String getName() {
return name;
}

public void setName(String anyName) {
name = anyName;
}

public int getMaximumBooks() {
return maximumBooks;
}

public void setMaximumBooks(int maximumBooks) {
this.maximumBooks = maximumBooks;
}
}


However, in the left margin of the pane there are warning triangles against the two lines :-

private String name; // name of the person
private int maximumBooks; //most books the person can check out

and the warnings that pop up say these fields are never read locally.


Hav I gotten some invisible corruption in the ASCII, I wonder?

Mike




Re: java snippet editor imports broken? [message #728377 is a reply to message #728374] Fri, 23 September 2011 07:01 Go to previous messageGo to next message
Mike Turner is currently offline Mike TurnerFriend
Messages: 8
Registered: September 2011
Junior Member
I made the warning disappear by cutting an pasting the whole pane across to MS notepad and back, but it has *not* cured the ;inspect' problem on the snippet editor

Maybe I should just start over.

Mike
Re: java snippet editor imports broken? [message #728878 is a reply to message #728377] Sat, 24 September 2011 07:24 Go to previous message
Mike Turner is currently offline Mike TurnerFriend
Messages: 8
Registered: September 2011
Junior Member
Simple in the end, the class had not been saved out.

Sorry for wasting peoples time Sad
Previous Topic:Java EE IDE issue
Next Topic:Possibility to remove button and a check-box from the progress modal dialog during a job execution
Goto Forum:
  


Current Time: Fri Apr 26 14:15:53 GMT 2024

Powered by FUDForum. Page generated in 0.03227 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top