Another kind of inspections : ...


How it works:
-


public interface Stringizable
{
String toDataString ();

/**

  • @WarnIf.NotExists(scope=children)

  • public static $Class$ fromDataString(String);

*/
}



The problem it solves:
-



The interface

public interface Stringizable {
String toDataString ();
}

guarantees that every class 'Klass' that implements it can export its
contents to a string.

Every class 'Klass' that implements Stringizable also offers the
symetrical method:
public static Klass fromDataString (String)

Problem: this method being static, we can't use the compiler to enforce
this rule through the interface.
This idea is about having IDEA help us track this bug before it's
happens at runtime.


Note: this is a particular case that could be extended to check other rules

Alain


Please sign in to leave a comment.