Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#171 FinalClass should not flag abstract classes

release_3.2
closed
Lars Kühne
Other (70)
5
2012-10-10
2003-11-06
Lars Kühne
No

Reported by Kevin Pearcey (kevinp guesswhat
amphora-research guesswhat c o m) on the user mailing list:

The example is for a typesafe enum to provide operation
for a calculator or such like application.

// Typesafe enum
public abstract class Operation
{
abstract double eval(double a, double b);

public static final Operation PLUS =
  new Operation("+")
  {
     double eval(double a, double b)
     {
        return a + b;
     }
  };

public static final Operation MINUS =
  new Operation("-")
  {
     double eval(double a, double b)
     {
        return a - b;
     }
  };

private String _name;
private Operation(String name)
{
    this._name = name;
}

}

Class needs to be abstract because it includes an
abstract method, but then the compiler complains if
it's final at the same time.

Discussion