Results 1 to 6 of 6
Like Tree1Likes
  • 1 Post By KevinWorkman

Thread: Compiler Warning:compile with -Xlint:unchecked

  1. #1
    harshit shah is offline Member
    Join Date
    Jan 2013
    Location
    Kolkata,India
    Posts
    86
    Rep Power
    0

    Default Compiler Warning:compile with -Xlint:unchecked

    Java Code:
    /**
     * Hangman.java
     * 
     */
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.border.Border;
    import java.util.*;
    
    public class Hangman {
        GallowsArea gallowsArea = null; //Null Object Design Pattern
    
        JButton exitButton    = null;
        JButton newGameButton = null;
    
        JLabel    wordArea    = null;
        JLabel    messageArea = null;
        java.util.List wordsButtonList = new ArrayList();
        Iterator alphaIterator = null;
    
        boolean headDrawn    = false;
        boolean bodyDrawn    = false;
        boolean leftArmDrawn = false;
        boolean rightArmDrawn= false;
        boolean leftLegDrawn = false;
        boolean rightLegDrawn= false;
    
        // Target words
        String[] targetWords = {"native", "gasoline", "messiah", "example", "prodigal","scythe", "charcoal", "fetter", "deport", "horizon",
                "luggage", "stammer", "prose","mountain", "fry",
                "deny"};
        String clues[] = {"A person born in a specified place","Refined petroleum","The promised deliverer","A thing characteristic of its kind or illustrating a general rule"," wastefully extravagant","A tool used for cutting crops such as grass or wheat","A porous black solid","A chain used to restrain a prisoner",
                "Exile","The line at which the earth's surface and the sky appear to meet","Suitcases or other bags",
                "Speak with sudden involuntary pauses","Written or spoken language","high hill","cook in oil","to refuse"};
    
        String losingPrefix  = "Wrong!  You die!  The answer was ";
        String currentGuess;
        String targetWord;
        String clue;
    
        int numberWrong       = 0;
        int numberOfBodyParts = 6;
        int next              = 0;
        /**
         * Set up a new game of "Hangman".
         */
        public void setUpNewGame() {
            //Present the new word
            double numb = Math.random();
            next = (int)( numb * targetWords.length );
            targetWord  = targetWords[next];
            clue = clues[next];
    
            numberWrong = 0;
            messageArea.setText(clues[next]);
    
            //Enable alphabet buttons
            Iterator alphaIterator = wordsButtonList.iterator();
            while( alphaIterator.hasNext() ) {
                ( (JButton)alphaIterator.next() ).setEnabled( true );
            }
    
            //Disable new game button
            newGameButton.setEnabled( false );
    
            //Color the word area
            wordArea.setBackground(Color.lightGray);
    
            //Fill the word-to-guess with ???
            currentGuess = "?";
            for( int i=0; i<targetWord.length()-1; i++) {
                currentGuess = currentGuess+"?";
            }
            wordArea.setText( currentGuess );
    
            //Nothing is drawn yet
            headDrawn    = false;
            bodyDrawn    = false;
            leftArmDrawn = false;
            rightArmDrawn= false;
            leftLegDrawn = false;
            rightLegDrawn= false;
            gallowsArea.repaint();
    
        }//setUpNewGame
    
        /**
         * Process a click on an alphabet button.  Right or not?
         *
         * @param answer Will be "a", "b", "c", etc.
         */
        public void processAnswer(String answer) {         // Have Vanna turn the correct letters over
            char newCharacter = answer.charAt(0);
    
            // Look thru the target word.
            // If the character matches the target, concat the new character.
            // If the character doesn't match the target, concat the character
            //    from the current guess.
            String nextGuess    = "";
            boolean foundAMatch = false;
            for( int i=0; i<targetWord.length(); i++ ) {
                char characterToMatch = targetWord.charAt(i);
                if( characterToMatch == newCharacter ) {
                    nextGuess = nextGuess+( String.valueOf(newCharacter) ); //amending char 
                    foundAMatch = true;
                }
                else {
                    nextGuess = nextGuess+(String.valueOf( currentGuess.charAt(i) )); //amending ? marks
                }
            }//for each character
            currentGuess = nextGuess;
            wordArea.setText( currentGuess );
    
            // We have a winner?
            if( currentGuess.equals( targetWord ) ) {
                //Disable the buttons
                Iterator alphaIterator = wordsButtonList.iterator();
                while( alphaIterator.hasNext() ) {
                    ( (JButton)alphaIterator.next() ).setEnabled( false );
                }
                messageArea.setText( "Congratulations!  You are a saved!" );
                newGameButton.setEnabled( true );
                exitButton.setEnabled( true );
            }
            // Wrong Answer
            //   Set out a new body part to be drawn by repaint()
            else {
                if( !foundAMatch ) {
                    numberWrong++;
                    switch (numberWrong){
                        case 1: { headDrawn     = true; break; }
                        case 2: { bodyDrawn     = true; break; }
                        case 3: { leftArmDrawn  = true; break; }
                        case 4: { rightArmDrawn = true; break; }
                        case 5: { leftLegDrawn  = true; break; }
                        case 6: { rightLegDrawn = true; break; }
                        default: System.out.println("You should be dead!");
                    }
                    // Repaint the gallows area JPanel
                    gallowsArea.repaint();
                }
                // Is the game over?
                if( numberWrong >= numberOfBodyParts ) {
                    //Disable the buttons
                    Iterator alphaIterator = wordsButtonList.iterator();
                    while( alphaIterator.hasNext() ) {
                        ( (JButton)alphaIterator.next() ).setEnabled( false );
                    }
                    messageArea.setText( losingPrefix + targetWord );
                    newGameButton.setEnabled( true );
                    exitButton.setEnabled( true );
                }
            }//if else
        }//processAnswer
    
        /**
         * Create the North pane of the BorderLayout used by the game.
         * The returned component is a JPanel with a single JLabel
         * where the word prompts will be displayed.
         *
         * @return JPanel for use displaying game words.
         */
        public Component createNorthPane() {
            JPanel pane = new JPanel();
            pane.setLayout( new BoxLayout( pane, BoxLayout.X_AXIS ) );
            pane.setBorder( BorderFactory.createEmptyBorder(0, 10, 10, 10) );
            pane.add(Box.createHorizontalGlue() );
            wordArea = new JLabel("Press New Game");
            wordArea.setFont( new Font("Helvetica", Font.PLAIN, 24) );
            wordArea.setBackground(Color.lightGray);
            wordArea.setForeground(Color.black);
            pane.add(wordArea);
            pane.add(Box.createHorizontalGlue() );
            return pane;
        }
    
        /**
         * Create the West pane of the BorderLayout used by the game.
         * The returned JPanel has 9 rows and 3 columns consisting of
         * buttons for each letter in the alphabet
         * Also creates the ActionListener for the alphabet buttons.
         *
         * @return JPanel with alphabet buttons in it.
         */
        public Component createWestPane() {
            ActionListener alphabetButtonAction = new ActionListener() {
                    public void actionPerformed( ActionEvent e ) {
                        Toolkit.getDefaultToolkit().beep();
                        JButton buttonPushed = (JButton)e.getSource();
                        buttonPushed.setEnabled( false );
                        processAnswer( buttonPushed.getText() ); // String sent to method
                    }
                };
    
            JPanel pane = new JPanel();
            pane.setBorder(BorderFactory.createLoweredBevelBorder());
            GridBagLayout gridbag = new GridBagLayout();
            GridBagConstraints c  = new GridBagConstraints();
            pane.setLayout( gridbag );
            c.fill = GridBagConstraints.BOTH;
    
            JButton button = new JButton( "a" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 0;
            c.gridy      = 0;
            c.gridheight = 1;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "b" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 1;
            c.gridy      = 0;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "c" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 2;
            c.gridy      = 0;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "d" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 0;
            c.gridy      = 1;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "e" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 1;
            c.gridy      = 1;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "f" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 2;
            c.gridy      = 1;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "g" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 0;
            c.gridy      = 2;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "h" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 1;
            c.gridy      = 2;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "i" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 2;
            c.gridy      = 2;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "j" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 0;
            c.gridy      = 3;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "k" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 1;
            c.gridy      = 3;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "l" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 2;
            c.gridy      = 3;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "m" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 0;
            c.gridy      = 4;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "n" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 1;
            c.gridy      = 4;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "o" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 2;
            c.gridy      = 4;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "p" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 0;
            c.gridy      = 5;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "q" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 1;
            c.gridy      = 5;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "r" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 2;
            c.gridy      = 5;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "s" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 0;
            c.gridy      = 6;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "t" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 1;
            c.gridy      = 6;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "u" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 2;
            c.gridy      = 6;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "v" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 0;
            c.gridy      = 7;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "w" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 1;
            c.gridy      = 7;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "x" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 2;
            c.gridy      = 7;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "y" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 0;
            c.gridy      = 8;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            button = new JButton( "z" );
            c.weightx    = 0.5;
            c.weighty    = 0.5;
            c.gridx      = 1;
            c.gridy      = 8;
            gridbag.setConstraints( button, c );
            button.addActionListener( alphabetButtonAction );
            pane.add( button );
            wordsButtonList.add( button );
    
            alphaIterator = wordsButtonList.iterator();
            while( alphaIterator.hasNext() ) {
                ( (JButton)alphaIterator.next() ).setEnabled( false );
            }
            return pane;
        }
    
        /**
         * Create the South pane of the BorderLayout used by the game.
         * The returned component is a JPanel with a single JLabel
         * where the winning and losing messages will be displayed.
         *
         * @return JPanel for use displaying winning and losing messages.
         */
        public Component createSouthPane() {
            JPanel pane = new JPanel();
            pane.setLayout( new BoxLayout( pane, BoxLayout.X_AXIS ) );
            pane.setBorder( BorderFactory.createEmptyBorder(10, 10, 10, 10) );
            pane.add(Box.createHorizontalGlue() );
    
            messageArea = new JLabel(clue);
            messageArea.setFont( new Font("Helvetica", Font.PLAIN, 28) );
            messageArea.setBackground( Color.lightGray );
            messageArea.setForeground( Color.red );
            pane.add(messageArea);
            pane.add(Box.createHorizontalGlue() );
            return pane;
        }
    
        /**
         * Create the Center pane of the BorderLayout used by the game.
         * The returned component is a JPanel where the
         * victim will be hanged.
         *
         * @return JPanel for use displaying gallows.
         */
        public Component createCenterPane() {
            // Pass the reference to this instance of the game so that
            //   the repaint() method can find out what to draw
            gallowsArea = new GallowsArea(this);
            return gallowsArea; // null object method
        }
    
        /**
         * Create the East pane of the BorderLayout used by the game.
         * The returned JPanel contains New Game and Exit buttons
         * arranged vertically in a BoxLayout form.
         *
         * @return JPanel with control buttons set in a BoxLayout.
         */
        public Component createEastPane() {
            ActionListener controlButtonListener = new ActionListener() {
                    public void actionPerformed( ActionEvent e ) {
                        JButton buttonPushed = (JButton)e.getSource();
                        if( buttonPushed.getText().equals("New Game") ) {
                            setUpNewGame();
                        }
                        else {
                            System.exit(0);
                        }
                    }//actionPerformed
                };//controlButtonListener
    
            JPanel pane = new JPanel();
            pane.setBorder(BorderFactory.createLoweredBevelBorder());
            pane.setLayout( new BoxLayout( pane, BoxLayout.Y_AXIS ) );
    
            newGameButton = new JButton( "New Game" );
            newGameButton.setFont( new Font("Helvetica", Font.PLAIN, 18) );
            newGameButton.setAlignmentX(Component.CENTER_ALIGNMENT);
            newGameButton.addActionListener( controlButtonListener );
            pane.add( newGameButton );
    
            pane.add( Box.createVerticalGlue() );
    
            exitButton = new JButton( "Exit" );
            exitButton.setFont( new Font("Helvetica", Font.PLAIN, 18) );
            exitButton.setAlignmentX(Component.CENTER_ALIGNMENT);
            exitButton.addActionListener( controlButtonListener );
            pane.add( exitButton );
    
            return pane;
        }
    
        /**
         * Create the components for the game GUI.
         * The returned JPanel will have all the elements of the GUI
         * arranged in a BorderLayout.
         *
         * @return JPanel with GUI elements arranged in a BorderLayout.
         */
        public Component initComponents() {
            JPanel panel_final = new JPanel();
            panel_final.setBorder(BorderFactory.createLoweredBevelBorder());
            panel_final.setLayout(new BorderLayout() );
            panel_final.add( createNorthPane(),  BorderLayout.NORTH );
            panel_final.add( createWestPane(),   BorderLayout.WEST );
            panel_final.add( createSouthPane(),  BorderLayout.SOUTH );
            panel_final.add( createCenterPane(), BorderLayout.CENTER );
            panel_final.add( createEastPane(),   BorderLayout.EAST );
    
            return panel_final;
        }
    
        public static void main() {
    
            try {
                UIManager.setLookAndFeel( "javax.swing.plaf.metal.MetalLookAndFeel");
            } catch (Exception e) { }
    
            //Create the top-level container and add contents to it.
            JFrame frame = new JFrame("Hangman");
            frame.setSize( new Dimension(640,480) );
            Hangman app = new Hangman(); //creating object app
            Component contents = app.initComponents();
    
            frame.getContentPane().add(contents);
    
            //Finish setting up the frame, and show it.
            frame.addWindowListener(new WindowAdapter() {
                    public void windowClosing(WindowEvent e) {
                        System.exit(0);
                    }
                });
    
            frame.setVisible(true);
        }
    }
    
    /**
     * Class GallowsArea
     */
    class GallowsArea extends JPanel {
        Hangman controller;
    
        public GallowsArea(Hangman controller) {
            this.controller = controller;
            Border raisedBevel = BorderFactory.createRaisedBevelBorder();
            Border loweredBevel = BorderFactory.createLoweredBevelBorder();
            Border compound = BorderFactory.createCompoundBorder
                ( raisedBevel, loweredBevel );
            setBorder( compound );
        }
    
        public void paintComponent( Graphics g ) {
            super.paintComponent( g );
            //Draw the pole
            g.setColor(Color.black);
            g.drawRect(10, 10, 25, 350);
            g.drawRect(10, 10, 200, 25);
            g.setColor(Color.darkGray);
            g.fillRect( 11, 11, 24, 349 );
            g.fillRect(11, 11, 199, 24);
    
            //Draw the head and noose
            if( controller.headDrawn ){
                g.setColor(Color.white);
                g.fillRect(210,35,6,15); // x,y,width,height
                g.setColor(Color.pink);
                g.fillOval(200, 50, 30, 30);
                g.setColor(Color.white);
                g.fillRect(207,75,15,6);
            }
    
            //Draw the body
            if( controller.bodyDrawn ){
                g.setColor(Color.black);
                g.fillOval(195, 80, 40, 80);
            }
    
            //Draw the left arm
            if( controller.leftArmDrawn ){
                g.setColor(Color.black);
                // fillPolygon(xPoints, yPoints, numPoints)
                int x6Points[] = {220, 240, 270, 270, 240, 220};
                int y6Points[] = {85,   90,  85,  95, 100,  95};
                g.fillPolygon(x6Points, y6Points, x6Points.length);
            }
    
            //Draw the right arm
            if( controller.rightArmDrawn ){
                g.setColor(Color.black);
                int x6Points[] = {210, 190, 160, 160, 190, 210};
                int y6Points[] = {85,   90,  85,  95, 100,  95};
                g.fillPolygon(x6Points, y6Points, x6Points.length);
            }
    
            //Draw the left leg
            if( controller.leftLegDrawn ){
                g.setColor(Color.black);
                int x9Points[] = {220, 250, 270, 270, 280, 280, 270, 250, 220};
                int y9Points[] = {130, 140, 160, 190, 190, 200, 200, 160, 160};
                g.fillPolygon(x9Points, y9Points, x9Points.length);
            }
    
            //Draw the right leg and finishing touches -- he's dead
            if( controller.rightLegDrawn ){
                g.setColor(Color.black);
                int x9Points[] = {210, 180, 160, 160, 150, 150, 160, 180, 210};
                int y9Points[] = {130, 140, 160, 190, 190, 200, 200, 160, 160};
                g.fillPolygon(x9Points, y9Points, x9Points.length);
                g.drawLine(206,65,212,65); // this lines make + + design on the head
                g.drawLine(209,62,209,68);
                g.drawLine(217,65,223,65);
                g.drawLine(220,62,220,68);
            }
        }
    }//GallowsArea
    As the title suggests the program gives a compiler warning.The program although works fine.I did some research and found out that :
    This comes up in Java 5 and later if you're using collections without type specifiers (e.g., Arraylist() instead of ArrayList<String>()). It means that the compiler can't check that you're using the collection in a type-safe way, using generics.

    To get rid of the warning, just be specific about what type of objects you're storing in the collection. So, instead of

    List myList = new ArrayList();
    use

    List<String> myList = new ArrayList<String>();
    By doing that also my program goes haywire.Please help.

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,014
    Rep Power
    10

    Default Re: Compiler Warning:compile with -Xlint:unchecked

    When posting code, it's best to boil it down to an SSCCE. You have a ton of extra code here, which will only decrease your chances of getting help.

    What do you mean when you say it goes haywire? I recommend posting an SSCCE showing what you're trying to do (in as few lines as possible) as well as any errors you get.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default Re: Compiler Warning:compile with -Xlint:unchecked

    Have you ACTUALLY added "-Xlint:unchecked" to the compiler arguments and recompiled? THAT will tell you EXACTLY where the possible problems are.

  4. #4
    harshit shah is offline Member
    Join Date
    Jan 2013
    Location
    Kolkata,India
    Posts
    86
    Rep Power
    0

    Default Re: Compiler Warning:compile with -Xlint:unchecked

    Quote Originally Posted by masijade View Post
    Have you ACTUALLY added "-Xlint:unchecked" to the compiler arguments and recompiled? THAT will tell you EXACTLY where the possible problems are.
    Sir,
    If you could please tell me how to do that .I would be grateful and post my findings.

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,173
    Rep Power
    20

    Default Re: Compiler Warning:compile with -Xlint:unchecked

    Well, how are you compiling this?

    Anyway, if you've used generics (ie any ArrayList is now an ArrayList<SomeClass>) and it has "gone haywire", it might be an idea to explain what that means.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  6. #6
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,014
    Rep Power
    10

    Default Re: Compiler Warning:compile with -Xlint:unchecked

    Quote Originally Posted by harshit shah View Post
    I wish to close this question.How do I close this thread?
    Generally, you explain what the answer to your problem was, that way people with similar problems in the future can learn from your question.
    DarrylBurke likes this.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Unchecked warning
    By anjibman in forum New To Java
    Replies: 1
    Last Post: 10-23-2012, 02:51 AM
  2. Replies: 3
    Last Post: 08-11-2012, 02:58 AM
  3. Replies: 9
    Last Post: 05-11-2011, 05:31 PM
  4. unchecked or unsafe operations-Recompile with -Xlint
    By pronetin in forum Advanced Java
    Replies: 15
    Last Post: 05-31-2010, 06:41 PM
  5. Unchecked or unsafe operations warning
    By sky in forum New To Java
    Replies: 3
    Last Post: 12-06-2009, 04:41 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •