Bug 576549 - [type filters] Missing proposals in Swing, etc. because of java.awt.* type filter enabled by default
Summary: [type filters] Missing proposals in Swing, etc. because of java.awt.* type fi...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.21   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.22 M2   Edit
Assignee: Andrey Loskutov CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 576708 576727 576862 576863 576982 577030 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-10-10 10:07 EDT by Holger Voormann CLA
Modified: 2021-11-06 05:03 EDT (History)
10 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Holger Voormann CLA 2021-10-10 10:07:14 EDT
Since 4.21, the type filter java.awt.* has been added and is enabled by default (see bug 571758).

Unfortunately, the AWT API is exposed/used in Swing, for example by javax.swing.JFrame extending java.awt.Frame, by javax.swing.JComponent extending java.awt.Component which provides the method getBounds() that returns a java.awt.Rectangle, etc.

There is also java.awt.Robot contained in AWT without there being an alternative for that in Swing or somewhere else.

Samples:

class Sample extends javax.swing.JFrame {
	void init() {
		| // <- here no proposal for "setSize(...)"
	}
	void foo(javax.swing.JFrame jFrame) {
		jFrame.| // <- here no proposal for "setSize(...)"
	}
	void bounds() {
		this.getBounds().| // <- here no proposal for "x"
	}
	void robot() {
		new Rob| // <- here no proposal for "Robot"
	}
}

A couple of questions were asked on Stack Overflow because of this (most are closed as duplicate of the first; some might already be deleted):
- https://stackoverflow.com/q/69357171/6505250 (JFrame)
- https://stackoverflow.com/q/69515233/6505250 (Rectangle)
- https://stackoverflow.com/q/69511421/6505250 (Graphics)
- https://stackoverflow.com/q/69509896/6505250 (BorderLayout)
- https://stackoverflow.com/q/69393367/6505250 (JFrame)
- https://stackoverflow.com/q/69415574/6505250 (JFrame)
- https://stackoverflow.com/q/69399195/6505250 (BorderLayout)
- ...

I suggest removing the type filter "java.awt.*" or at least disabling it by default.
Instead, I would like to have "java.awt.List" filtered by default.
Comment 1 Greg Pugh CLA 2021-10-17 03:23:25 EDT
There continues to be a steady stream of questions caused by this on Stack Overflow. It is really confusing beginners
Comment 2 Holger Brands CLA 2021-10-18 14:29:30 EDT
+1
Please don't filter *standard* Java APIs by default. Let the user decide.
Comment 3 Eclipse Genie CLA 2021-10-19 03:49:14 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/186646
Comment 4 Andrey Loskutov CLA 2021-10-19 03:49:40 EDT
*** Bug 576708 has been marked as a duplicate of this bug. ***
Comment 5 Andrey Loskutov CLA 2021-10-19 03:50:43 EDT
(In reply to Eclipse Genie from comment #3)
> New Gerrit change created:
> https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/186646

That re-adds awt except List and graal thingy reported by bug 576708.
Comment 6 Vikas Chandra CLA 2021-10-19 11:11:20 EDT
*** Bug 576727 has been marked as a duplicate of this bug. ***
Comment 7 Noopur Gupta CLA 2021-10-20 08:52:52 EDT
(In reply to Andrey Loskutov from comment #5)
> (In reply to Eclipse Genie from comment #3)
> > New Gerrit change created:
> > https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/186646
> 
> That re-adds awt except List and graal thingy reported by bug 576708.

Thanks for the patch, Andrey. Updating these type filters makes sense based on the bug reports.
Comment 8 Andrey Loskutov CLA 2021-10-21 08:45:02 EDT
(In reply to Noopur Gupta from comment #7)
> (In reply to Andrey Loskutov from comment #5)
> > (In reply to Eclipse Genie from comment #3)
> > > New Gerrit change created:
> > > https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/186646
> > 
> > That re-adds awt except List and graal thingy reported by bug 576708.
> 
> Thanks for the patch, Andrey. Updating these type filters makes sense based
> on the bug reports.

OK to merge now for M2?
Comment 10 Noopur Gupta CLA 2021-10-21 09:46:14 EDT
(In reply to Andrey Loskutov from comment #8)
> OK to merge now for M2?
Done. Thanks!
Comment 11 Andrey Loskutov CLA 2021-10-24 06:36:10 EDT
*** Bug 576862 has been marked as a duplicate of this bug. ***
Comment 12 Andrey Loskutov CLA 2021-10-24 07:21:20 EDT
*** Bug 576863 has been marked as a duplicate of this bug. ***
Comment 13 Andrey Loskutov CLA 2021-11-02 17:50:41 EDT
*** Bug 576982 has been marked as a duplicate of this bug. ***
Comment 14 Andrey Loskutov CLA 2021-11-06 05:03:10 EDT
*** Bug 577030 has been marked as a duplicate of this bug. ***