1 2 3 Previous Next 34 Replies Latest reply: Feb 19, 2009 2:05 AM by EJP Go to original post RSS
      • 15. Re: Recompile with -Xlint:unchecked for details. When compiling
        843810
        javaapplication1\Connect.java uses or overrides a deprecated API.
        Note: Recompile with -Xlint:deprecation for details.

        please tell me what to do next?
        • 16. Re: Recompile with -Xlint:unchecked for details. When compiling
          EJP
          javaapplication1\Connect.java uses or overrides a
          deprecated API.
          Note: Recompile with -Xlint:deprecation for details.

          please tell me what to do next?
          Err, recompile with -Xlint:deprecation?

          It's an option for javac.
          • 17. Re: Recompile with -Xlint:unchecked for details. When compiling
            843810
            Take a look at:
            http://java.sun.com/j2se/1.4.2/docs/tooldocs/solaris/javac.html

            You will notice that -Xlint option is not introduced in this version.

            Now check
            http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/javac.html

            and you will see the -Xlint options.

            If you get this error message then most likely you are using an IDE/ java editor that is pointing to a more recent version of JDK, most likely it was shipped with it, and after getting this warning message on the IDE you are probably going to the command line, specifying the -Xlint option, and see the message you posted as your system env has JDK1.4.2 in its path.
            • 18. Re: Recompile with -Xlint:unchecked for details. When compiling
              843810
              I am using NetBeans 5.51, how can I add it?

              Thanks
              • 19. Re: Recompile with -Xlint:unchecked for details. When compiling
                EJP
                IKn the Compiling options for the project.
                • 20. Re: Recompile with -Xlint:unchecked for details. When compiling
                  843810
                  At the time of compiliation message apears Recompile with _Xlint : Uncheck for details                                                                                                                                                                           
                  • 21. Re: Recompile with -Xlint:unchecked for details. When compiling
                    EJP
                    You are correct, that is the topic of this thread.
                    • 22. Re: Recompile with -Xlint:unchecked for details. When compiling
                      843810
                      When I compile my program (I'm using JCreator LE) I get the same "Recompile with -Xlint: unchecked for details" error. How do I uncheck -Xlint?
                      • 23. Re: Recompile with -Xlint:unchecked for details.
                        843810
                        Good one.

                        That is not
                        JewsusKhan wrote:
                        "Recompile with -Xlint: unchecked for details"
                        but
                        "Recompile with [-Xlint:unchecked|http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/javac.html#options] for details"
                        • 24. Re: Recompile with -Xlint:unchecked for details. When compiling
                          608410
                          "Recompile with -Xlint: unchecked for details" error. How do I uncheck -Xlint?
                          Nothing is foolproof because fools are so ingenious
                          • 25. Re: Recompile with -Xlint:unchecked for details. When compiling
                            843810
                            I'm running JCreator 4.5 LE and I'm trying the GridWorld project for the AP exam come Spring--each time I compile/run, I get:
                            --------------------Configuration: BoxBug1 - JDK version 1.6.0_07 <Default> - <Default>--------------------
                            Note: C:\APCS\gridworld\BoxBug1\info\gridworld\grid\BoundedGrid.java uses unchecked or unsafe operations.
                            Note: Recompile with -Xlint:unchecked for details.
                            Process completed.

                            Now, it runs just fine, and I understand how to turn off the warnings if I need it--but what I'm curious about is how to fix the unchecked or unsafe parts so that it IS checked and/or safe. Here's the .class that the error message is complaining about:
                            /* 
                             * AP(r) Computer Science GridWorld Case Study:
                             * Copyright(c) 2002-2006 College Entrance Examination Board 
                             * (http://www.collegeboard.com).
                             *
                             * This code is free software; you can redistribute it and/or modify
                             * it under the terms of the GNU General Public License as published by
                             * the Free Software Foundation.
                             *
                             * This code is distributed in the hope that it will be useful,
                             * but WITHOUT ANY WARRANTY; without even the implied warranty of
                             * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                             * GNU General Public License for more details.
                             * 
                             * @author Alyce Brady
                             * @author APCS Development Committee
                             * @author Cay Horstmann
                             */
                            
                            package info.gridworld.grid;
                            
                            import java.util.ArrayList;
                            
                            /**
                             * A <code>BoundedGrid</code> is a rectangular grid with a finite number of
                             * rows and columns. <br />
                             * The implementation of this class is testable on the AP CS AB exam.
                             */
                            public class BoundedGrid<E> extends AbstractGrid<E>
                            {
                                private Object[][] occupantArray; // the array storing the grid elements
                            
                                /**
                                 * Constructs an empty bounded grid with the given dimensions.
                                 * (Precondition: <code>rows > 0</code> and <code>cols > 0</code>.)
                                 * @param rows number of rows in BoundedGrid
                                 * @param cols number of columns in BoundedGrid
                                 */
                                public BoundedGrid(int rows, int cols)
                                {
                                    if (rows <= 0)
                                        throw new IllegalArgumentException("rows <= 0");
                                    if (cols <= 0)
                                        throw new IllegalArgumentException("cols <= 0");
                                    occupantArray = new Object[rows][cols];
                                }
                            
                                public int getNumRows()
                                {
                                    return occupantArray.length;
                                }
                            
                                public int getNumCols()
                                {
                                    // Note: according to the constructor precondition, numRows() > 0, so
                                    // theGrid[0] is non-null.
                                    return occupantArray[0].length;
                                }
                            
                                public boolean isValid(Location loc)
                                {
                                    return 0 <= loc.getRow() && loc.getRow() < getNumRows()
                                            && 0 <= loc.getCol() && loc.getCol() < getNumCols();
                                }
                            
                                public ArrayList<Location> getOccupiedLocations()
                                {
                                    ArrayList<Location> theLocations = new ArrayList<Location>();
                            
                                    // Look at all grid locations.
                                    for (int r = 0; r < getNumRows(); r++)
                                    {
                                        for (int c = 0; c < getNumCols(); c++)
                                        {
                                            // If there's an object at this location, put it in the array.
                                            Location loc = new Location(r, c);
                                            if (get(loc) != null)
                                                theLocations.add(loc);
                                        }
                                    }
                            
                                    return theLocations;
                                }
                            
                                public E get(Location loc)
                                {
                                    if (!isValid(loc))
                                        throw new IllegalArgumentException("Location " + loc
                                                + " is not valid");
                                    return (E) occupantArray[loc.getRow()][loc.getCol()]; // unavoidable warning
                                }
                            
                                public E put(Location loc, E obj)
                                {
                                    if (!isValid(loc))
                                        throw new IllegalArgumentException("Location " + loc
                                                + " is not valid");
                                    if (obj == null)
                                        throw new NullPointerException("obj == null");
                            
                                    // Add the object to the grid.
                                    E oldOccupant = get(loc);
                                    occupantArray[loc.getRow()][loc.getCol()] = obj;
                                    return oldOccupant;
                                }
                            
                                public E remove(Location loc)
                                {
                                    if (!isValid(loc))
                                        throw new IllegalArgumentException("Location " + loc
                                                + " is not valid");
                                    
                                    // Remove the object from the grid.
                                    E r = get(loc);
                                    occupantArray[loc.getRow()][loc.getCol()] = null;
                                    return r;
                                }
                            }
                            • 26. Re: Recompile with -Xlint:unchecked for details. When compiling
                              EJP
                              private Object[][] occupantArray; // the array storing the grid elements
                              private E[][] occupantArray; // the array storing the grid elements
                              • 27. Re: Recompile with -Xlint:unchecked for details. When compiling
                                843810
                                what is Xlint?
                                when i compiled the program
                                the compiler displays following message on the screen why so?
                                Recompile with -Xlint:unchecked for details. When compiling
                                • 28. Re: Recompile with -Xlint:unchecked for details. When compiling
                                  EJP
                                  Your question was answered [here, in this same thread, *four years ago*|http://forums.sun.com/thread.jspa?messageID=3072287#3072287]. Please read the thread before you post.
                                  • 29. Re: Recompile with -Xlint:unchecked for details. When compiling
                                    843810
                                    how do you find the xlint option on java?

                                    sorry for sounding noob lol