fuyou001
fuyou001

Reputation: 1642

guava source code in IDEA has errors ,what 's happen

I want to study guava .so i want to build from source code
1:git clone https://code.google.com/p/guava-libraries/
2:import to IDEA
3:then Absent class has error
the error is Class Absent must either be declared abstract or implements abstract method transform(Function) in Optional
the more info ,see attach file
how to solve it ?
enter image description here

enter image description here

enter image description here

Upvotes: 0

Views: 219

Answers (1)

lbalazscs
lbalazscs

Reputation: 17784

The abstract class Optional has the following function:

public abstract <V> Optional<V> transform(Function<? super T, V> function);

The class Absent implements it like this:

@Override public <V> Optional<V> transform(Function<Object, V> function) {

This is correct Java. I think Idea has a bug here, when it does not recognize this overriding correctly. However you should be able to compile this code, because for compiling Idea uses the javac compiler.

Upvotes: 1

Related Questions