alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (NonSAM2.java)

This example Java source code file (NonSAM2.java) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

abc, bar1, bar2, foo1, foo1bar1, foo2, foo2bar2, integer, util

The NonSAM2.java Java example source code

/*
 * @test /nodynamiccopyright/
 * @bug 8003280
 * @summary Add lambda tests
 *   This test is for identifying a non-SAM type: Having more than one methods due to inheritance, and none of them has a subsignature of all other methods
 * @compile/fail/ref=NonSAM2.out -XDrawDiagnostics NonSAM2.java Helper.java
 */

import java.util.List;

interface Foo1 { int getAge(String s);}
interface Bar1 { Integer getAge(String s);}
interface Foo1Bar1 extends Foo1, Bar1 {} //types Bar1 and Foo1 are incompatible; both define getAge(String), but with unrelated return types

interface AC extends A, C {} //name clash: getOldest(List<?>) in C and getOldest(List) in A have the same erasure, yet neither overrides the other
interface ABC extends A, B, C {} //ok - raw override
interface AD extends A, D {} //name clash: getOldest(List<Integer>) in D and getOldest(List) in A have the same erasure, yet neither overrides the other

interface Foo2<T> { void m(T arg);}
interface Bar2<S> { void m(S arg);}
interface Foo2Bar2<T1, T2> extends Foo2, Bar2 {} //name clash: m(S) in Bar and m(T) in Foo have the same erasure, yet neither overrides the other

Other Java examples (source code examples)

Here is a short list of links related to this Java NonSAM2.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.