Java Developer Tools

Implicit References

Implicit referencing is the term which is used to name a references to the elements of code base which are calculated by additional dead code analyzer extensions and does not come directly from analysis of application source code. Lets look on a simplest samples of such reference:

package com.sample;

import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;

import javax.swing.JFrame;

public class MyPane extends JFrame{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	FocusListener focusListener = new FocusListener(){

		public void focusGained(FocusEvent arg0) {
			//some functionality here
		}

		public void focusLost(FocusEvent arg0) {
			//some functionality here
		}
		
	};
	
	public MyPane(){
		addFocusListener(focusListener);
	}
	
	public static void main(String[] args) {
		MyPane myPane = new MyPane();
		myPane.pack();
		myPane.setVisible(true);		
	}
}

In this sample methods focusLost and focusGained are never called directly from application source code. But this methods are still not dead code and may not be safely removed because they will be called from Swing runtime when myPane will gain or loose focus. Dead Code analyzer is taking in account a lot of different kinds of such references. There are following major sorts of references that are discovered by Dead Code analyzer:

  • Possible references from binary on the project class path
  • References to fully qualified class names from xml files in workspace
  • References from JSP files, including JSF bindings
  • References that came from calling method via reflection when method and class name are string literals or may be evaluated easily
  • References that came from calling method via reflection when method and class name are string literals or may be evaluated easily

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.