Eclipse配置:如何动态显示方法参数名?部分类设置不生效
Hey there! I see you've got Code Minings working for your noeud_custom class but not for other custom classes like your LinkedList—let's walk through the most likely fixes to get this sorted out.
1. Ensure Debug Information is Enabled for Compilation
Eclipse's Parameter Name Minings rely on debug information stored in your compiled .class files. If your other custom classes weren't compiled with this info, Eclipse can't pull the parameter names to display. Here's how to check:
- Go to
Window > Preferences > Java > Compiler - Look for the option "Add variable attributes to generated class files (used by the debugger)"
- Make sure this is checked, and set the dropdown to "All" (or at minimum "Parameters")
- Hit
Apply and Close, then clean and rebuild your project (right-click project →Clean...→Build Project)
2. Verify All Code Minings Subsettings Are Enabled
You already turned on Enable Code Minings and disabled Only if there is at least one result, but double-check the specific Parameter Name mining toggle:
- Go to
Window > Preferences > Java > Editor > Code Minings - Under the
Javasection, ensure "Parameter Name Minings" is checked - This ensures Eclipse is explicitly set to show parameter names for all applicable methods
3. Check Your Custom Class Method Definitions
Make sure the methods in your other custom classes (like LinkedList.addLast()) have explicit parameter names in their definitions. For example:
Good (has parameter name to display):
public void addLast(Object element) { // ... implementation }Bad (no parameter name available):
public void addLast(Object) { // ... implementation }
If your method only specifies the parameter type without a name, Eclipse has nothing to show in the Code Mining.
4. Refresh and Reset Code Minings (Quick Troubleshoot)
Sometimes Eclipse's settings can get stuck—try a quick reset:
- Uncheck
Enable Code MiningsinWindow > Preferences > Java > Editor > Code Minings, hitApply - Re-check it, uncheck
Only if there is at least one resultagain, hitApply and Close - Refresh your project (press F5) and recompile
After going through these steps, your other custom classes' method parameters should show up in the editor just like your noeud_custom class does!
内容的提问来源于stack exchange,提问作者Chewbaka




