<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="http://wiki.apidesign.org/skins/common/feed.css?116"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.apidesign.org/index.php?action=history&amp;feed=atom&amp;title=InstanceOf</id>
		<title>InstanceOf - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.apidesign.org/index.php?action=history&amp;feed=atom&amp;title=InstanceOf"/>
		<link rel="alternate" type="text/html" href="http://wiki.apidesign.org/index.php?title=InstanceOf&amp;action=history"/>
		<updated>2026-04-11T01:25:19Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.12.0rc1</generator>

	<entry>
		<id>http://wiki.apidesign.org/index.php?title=InstanceOf&amp;diff=5219&amp;oldid=prev</id>
		<title>JaroslavTulach: New page: Properly used Covariance is said to be source compatible, but there is one language contruct which can lead to broken code - '''instanceof'''. The JavaC act...</title>
		<link rel="alternate" type="text/html" href="http://wiki.apidesign.org/index.php?title=InstanceOf&amp;diff=5219&amp;oldid=prev"/>
				<updated>2011-10-19T17:41:25Z</updated>
		
		<summary type="html">&lt;p&gt;New page: Properly used &lt;a href=&quot;/wiki/Covariance&quot; title=&quot;Covariance&quot;&gt;Covariance&lt;/a&gt; is said to be &lt;a href=&quot;/wiki/SourceCompatibility&quot; class=&quot;mw-redirect&quot; title=&quot;SourceCompatibility&quot;&gt;source compatible&lt;/a&gt;, but there is one language contruct which can lead to broken code - '''instanceof'''. The &lt;a href=&quot;/wiki/JavaC&quot; title=&quot;JavaC&quot;&gt;JavaC&lt;/a&gt; act...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Properly used [[Covariance]] is said to be [[SourceCompatibility|source compatible]], but there is one language contruct which can lead to broken code - '''instanceof'''. The [[JavaC]] acts cleverly and checks not just lower bound of the first parameter, but upper bound. For example following code is not going to compile:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
String s = &amp;quot;&amp;quot;;&lt;br /&gt;
assert s instanceof Integer;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The [[JavaC]] complains about ''inconvertible types''. Simple change to the program fixes the problem:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
Object s = &amp;quot;&amp;quot;;&lt;br /&gt;
assert s instanceof Integer;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Knowing this [[JavaC]] behavior, I am sure you can write code that will compile with the [[API]] used in [[Covariance]] example version 1.0 and will break the compilation against version 2.0. Am I right?&lt;/div&gt;</summary>
		<author><name>JaroslavTulach</name></author>	</entry>

	</feed>