3.8. Inserting Method Parameter Names

Problem

You forgot the parameters of a method you want to call, and instead of receiving hints in tool tips (see the previous recipe), you want Eclipse to fill in the parameter names in your code for you.

Solution

Select Window Preferences Java Editor Code Assist, and check the “Fill argument names on method completion” and “Guess filled argument names” checkboxes.

Discussion

When you check these checkboxes, code assist automatically fills in names of the parameters passed to that method in your code. For example, say you’ve typed java.util.Arrays.fill, and you press Ctrl-Space to invoke code assist, then you select one of the methods code assist offers you. Code assist will insert names for each parameter into your code, and as you tab between them, it displays their type in a tool tip, as shown in Figure 3-11.

Auto-naming of parameters

Figure 3-11. Auto-naming of parameters

Get Eclipse Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.