typetools / typetools/checker-framework

awt package not annotated

Open
#1,188 17 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.1k
Forks
440
Avg merge
1d 12h
Merged PRs (30d)
134

Description

In the following code:

import javax.swing.* ;
import java.awt.* ;
import java.awt.event.* ;
class cardTest implements ActionListener
{
JFrame fr;
JPanel pnl1;

	JButton b1,b2,b3,b4;

	Icon ic1,ic2,ic3,ic4;

	CardLayout card;		
	cardTest()
	{
		ic1=new ImageIcon("img3.jpg");
		ic2=new ImageIcon("img4.jpg");
		ic3=new ImageIcon("img2.png");
		ic4=new ImageIcon("img1.jpg");
		fr=new JFrame("Menu Test");
		pnl1=new JPanel();
		fr.add(pnl1);
		
		b3=new JButton(ic3);
		b4=new JButton(ic4);
		b1=new JButton(ic1);
		b2=new JButton(ic2);

		card=new CardLayout();

		pnl1.setLayout(card);

		pnl1.add(b1);
		b1.addActionListener(this);
		pnl1.add(b2);
		b2.addActionListener(this);

		pnl1.add(b3);
		b3.addActionListener(this);
		pnl1.add(b4);
		b4.addActionListener(this);
		
		fr.setSize(500,500);
		fr.setVisible(true);



	}
	public void actionPerformed(ActionEvent ed)
	{
		card.next(pnl1);
	}
	public static void main(String []args)
	{
		new cardTest();
	}

}

If we compile this code with command
javac cardTest.java
It will work properly

But by using
javac -processor NullnessChecker cardTest.java
It is showing error in ActionListener(this)
It is not getting (this)

output:

screenshot 26

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the report with the provided cardTest.java example and compare javac cardTest.java with javac -processor NullnessChecker cardTest.java. Trace the reported error at each ActionListener(this) call; done means the AWT-related nullness checking no longer rejects this valid listener usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.