This site requires JavaScript, please enable it in your browser!
Greenfoot back
Busch2207
Busch2207 wrote ...

2011/6/11

Compiler Warnings

1
2
Busch2207 Busch2207

2011/6/11

#
When I compile my game then it opens a new Window called: "Compiler Warnings" And there is written: "Warnings from the last compilation Note Some input files use unchecked or unsafed operations" the game works, but it nerves if theres always opened a new Window by Compiling... this window just opens, if I add this pasage in one of my clases:
List<Barrier> B = getIntersectingObjects(Barrier.class);
        for(Barrier Bar : B)
        {
            Bar.Spoing(this);
        }
mik mik

2011/6/12

#
This is odd - as far as I know, these compiler warnings should be switched off by default in Greenfoot. I don't quite understand why this is on... Anyway, you can probably get rid of the warning by inserting a cast, thus (untested code):
List<Barrier> B = (List<Barrier>) getIntersectingObjects(Barrier.class);  
Busch2207 Busch2207

2011/6/12

#
I tryed it, and it works... But these compiler warnings although open, by compiling...
mik mik

2011/6/12

#
I'm not sure what you mean - do you still see the warnings after this change or not?
Busch2207 Busch2207

2011/6/12

#
Yes I still see this warning... I'm srorry, but my English is not very good...
mik mik

2011/6/13

#
Are you sure it comes from that line of code, not another?
Busch2207 Busch2207

2011/6/13

#
I'm very sure. When I delete this code, the compiler warning dont open...
nccb nccb

2011/6/14

#
I can't replicate the problem in Greenfoot 2.1.0. What version of Greenfoot are you using? And what is the type of Spoing?
Busch2207 Busch2207

2011/6/14

#
I'm using Greenfoot 2.1.0... And now i've got the same Compiler Warnings by this Code, too:
        List<Landscape> Landscapes = getObjectsAt(MouseX,MouseY,Landscape.class);
        for(Landscape Land : Landscapes)
        {
            int x = MouseX;
            int y = MouseY;
            GreenfootImage i = a.getImage();
            x=x-(a.getScreenX()-i.getWidth()/2);
            y=y-(a.getScreenY()-i.getHeight()/2);
            if(i.getColorAt(x,y).getAlpha()>10)
                return true;
        }
        return false;
This Code is written in my "world"-class... There seems to be a problem with some of your Codes... Because if I change the Code: getObjectsAt(int, int, Class); to: getObjects(Class); these Compiler Warnings don't open any more...
nccb nccb

2011/6/15

#
I've poked around a bit more, and I think that the warnings don't come up with the Oracle JDK, but they do come up with OpenJDK. Can you tell us which JDK you're using, just to confirm this? (Go to Help->About Greenfoot, and copy what it says next to "Virtual Machine")
Busch2207 Busch2207

2011/6/15

#
Virtual machine: Java HotSpot(TM) Client VM 20.0-b11 (Sun Microsystems Inc.)
danpost danpost

2011/6/15

#
I'm using Client VM 19.0-b09 (Sun ...) and am getting warnings also, which I was not getting prior to upgrading to Greenfoot 2.1.0. Mine say: (Title) Compiler Warnings (Text) Warnings from last compilation (Text) Note: Some input files use unchecked or unsafe operations. (Button) Close Also, after uploading a scenario, I get: (Title) greenfoot.gameserver.address (Text) Windows cannot find 'greenfoot.gameserver.address'. (Text) Make sure you typed the name correctly, and then try again. (Text) To search for a file, click the Start button, and then click Search. (Button) OK Neither of these seem to hinder compilation or uploading, but ARE bothersome messages. Also, there are no problems with the uploaded scenarios.
davmac davmac

2011/6/16

#
@danpost,
Also, after uploading a scenario, I get: (Title) greenfoot.gameserver.address (Text) Windows cannot find 'greenfoot.gameserver.address'. (Text) Make sure you typed the name correctly, and then try again. (Text) To search for a file, click the Start button, and then click Search. (Button) OK
I found what caused this and have fixed it (for the next version of Greenfoot). But I don't understand why you would get those compiler warnings. Do you have a scenario uploaded with source that exhibits the problem?
danpost danpost

2011/6/16

#
I have uploaded a version of KIAROCKS 'Infect' that I have been helping him on. It is called 'epidemic'. It gives me that message after compilation. Hope that helps.
davmac davmac

2011/6/16

#
Got it, thanks. I think I might know what the problem is now.
There are more replies on the next page.
1
2