<p dir="auto"><strong>Glide Version</strong>: 4.0.0-RC0</p>

<p dir="auto"><strong>Integration libraries</strong>: okhttp-integration:4.0.0-RC0</p>

<p dir="auto"><strong>Device/Android Version</strong>: Galaxy S6 SDK version 25</p>

<p dir="auto"><strong>Issue details / Repro steps / Use case background</strong>:<br>
When using an annotation processor, generated class GlideRequests contains duplicate field:</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@Override
  public &lt;ResourceType&gt; GlideRequest&lt;ResourceType&gt; as(Class&lt;ResourceType&gt; resourceClass) {
    return new GlideRequest&lt;&gt;(glide, this, resourceClass);
  }
  @Override
  public &lt;ResourceType&gt; GlideRequest&lt;ResourceType&gt; as(Class&lt;ResourceType&gt; resourceClass) {
    return (GlideRequest&lt;ResourceType&gt;) super.as(resourceClass);
  }"><pre class="notranslate"><span class="pl-c1">@</span><span class="pl-c1">Override</span>
  <span class="pl-k">public</span> &lt;<span class="pl-smi">ResourceType</span>&gt; <span class="pl-s1">GlideRequest</span>&lt;<span class="pl-s1">ResourceType</span>&gt; <span class="pl-s1">as</span>(<span class="pl-smi">Class</span>&lt;<span class="pl-smi">ResourceType</span>&gt; <span class="pl-s1">resourceClass</span>) {
    <span class="pl-k">return</span> <span class="pl-k">new</span> <span class="pl-smi">GlideRequest</span>&lt;&gt;(<span class="pl-s1">glide</span>, <span class="pl-smi">this</span>, <span class="pl-s1">resourceClass</span>);
  }
  <span class="pl-c1">@</span><span class="pl-c1">Override</span>
  <span class="pl-k">public</span> &lt;<span class="pl-smi">ResourceType</span>&gt; <span class="pl-s1">GlideRequest</span>&lt;<span class="pl-s1">ResourceType</span>&gt; <span class="pl-s1">as</span>(<span class="pl-smi">Class</span>&lt;<span class="pl-smi">ResourceType</span>&gt; <span class="pl-s1">resourceClass</span>) {
    <span class="pl-k">return</span> (<span class="pl-smi">GlideRequest</span>&lt;<span class="pl-smi">ResourceType</span>&gt;) <span class="pl-en">super</span>.<span class="pl-en">as</span>(<span class="pl-s1">resourceClass</span>);
  }</pre></div>
<p dir="auto">My module:</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@GlideModule
public class GlideAppModule extends AppGlideModule {
	@Override
	public void applyOptions(Context context, GlideBuilder builder) {
		builder.setDiskCache(new InternalCacheDiskCacheFactory(context, 20 * 1024 * 1024));
	}

	@Override
	public boolean isManifestParsingEnabled() {
		return false;
	}
}"><pre class="notranslate"><span class="pl-c1">@</span><span class="pl-c1">GlideModule</span>
<span class="pl-k">public</span> <span class="pl-k">class</span> <span class="pl-smi">GlideAppModule</span> <span class="pl-k">extends</span> <span class="pl-smi">AppGlideModule</span> {
	<span class="pl-c1">@</span><span class="pl-c1">Override</span>
	<span class="pl-k">public</span> <span class="pl-smi">void</span> <span class="pl-en">applyOptions</span>(<span class="pl-smi">Context</span> <span class="pl-s1">context</span>, <span class="pl-smi">GlideBuilder</span> <span class="pl-s1">builder</span>) {
		<span class="pl-s1">builder</span>.<span class="pl-en">setDiskCache</span>(<span class="pl-k">new</span> <span class="pl-smi">InternalCacheDiskCacheFactory</span>(<span class="pl-s1">context</span>, <span class="pl-c1">20</span> * <span class="pl-c1">1024</span> * <span class="pl-c1">1024</span>));
	}

	<span class="pl-c1">@</span><span class="pl-c1">Override</span>
	<span class="pl-k">public</span> <span class="pl-smi">boolean</span> <span class="pl-en">isManifestParsingEnabled</span>() {
		<span class="pl-k">return</span> <span class="pl-c1">false</span>;
	}
}</pre></div>
<p dir="auto">Extension:</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@GlideExtension
public final class GlideAppExtension {
	private GlideAppExtension() {}

	@GlideOption
	private static void cropCircle(RequestOptions options) {
		// TODO
	}
}"><pre class="notranslate"><span class="pl-c1">@</span><span class="pl-c1">GlideExtension</span>
<span class="pl-k">public</span> <span class="pl-k">final</span> <span class="pl-k">class</span> <span class="pl-smi">GlideAppExtension</span> {
	<span class="pl-k">private</span> <span class="pl-smi">GlideAppExtension</span>() {}

	<span class="pl-c1">@</span><span class="pl-c1">GlideOption</span>
	<span class="pl-k">private</span> <span class="pl-k">static</span> <span class="pl-smi">void</span> <span class="pl-en">cropCircle</span>(<span class="pl-smi">RequestOptions</span> <span class="pl-s1">options</span>) {
		<span class="pl-c">// TODO</span>
	}
}</pre></div>
<p dir="auto">Should i use in build.gradle:<br>
<code class="notranslate">annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC0'</code><br>
or<br>
<code class="notranslate">compile 'com.github.bumptech.glide:compiler:4.0.0-RC0</code></p>
<p dir="auto">I've tried both, and tried SNAPSHOT version<br>
Also in the documentation example the first argument is RequestOptions&lt;?&gt;, but the class from the sources is not generic?</p>
<p dir="auto">Also in the code bellow, error drawable is not used when the url is null, and docs state: "null models will cause the error drawable to be displayed", this is working in the latest 3.x version.</p>

<p dir="auto"><strong>Glide load line / <code class="notranslate">GlideModule</code> (if any) / list Adapter code (if any)</strong>:</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="GlideApp.with(this).load(contractImage) // contractImage is null
			        .transform(new CropCircleTransformation())
			        .error(errorDrawable)
			        .into(imageView);"><pre class="notranslate"><span class="pl-smi">GlideApp</span>.<span class="pl-en">with</span>(<span class="pl-smi">this</span>).<span class="pl-en">load</span>(<span class="pl-s1">contractImage</span>) <span class="pl-c">// contractImage is null</span>
			        .<span class="pl-en">transform</span>(<span class="pl-k">new</span> <span class="pl-smi">CropCircleTransformation</span>())
			        .<span class="pl-en">error</span>(<span class="pl-s1">errorDrawable</span>)
			        .<span class="pl-en">into</span>(<span class="pl-s1">imageView</span>);</pre></div>
<p dir="auto">We just started using Glide and I've been comparing the default RESULT disk cache strategy vs. SOURCE and I'm noticing that SOURCE is noticeably faster to render a newly net-retrieved image to the screen.</p>
<p dir="auto">I'm playing with two second-gen Nexus 7's with Lollipop side-by-side with images ~200K, 700x700 average.  I made the most minimal example I can and have ~100 images in a vanilla RecyclerView with a LinearLayoutManager where 4-5 images will be visible on screen at a time.  If I start up both configurations from scratch and scroll to the very bottom of the view the SOURCE config finishes showing the images in less than a second whereas the RESULT config finishes showing them in 2-4 seconds.  This is consistent with regular scrolling where images come down one at a time: SOURCE is always faster than RESULT.</p>
<p dir="auto">Without diving in too deep into the code myself I'm suspecting that RESULT resizes the image before it shows it on screen.  I'd imagine you could make it as fast as SOURCE if on the first/network retrieval you immediately show the full image in the view like SOURCE but on a background thread continue resizing the image and store it in the disk cache resized so on the second request it shows up resized.</p>
<p dir="auto">And now that I've actually typed all that out I can see how that might be unexpected for someone not using something like fitCenter() where the difference between SOURCE and RESULT looks almost the same on screen...hmmm.</p>
<p dir="auto">Does this use case sound interesting to you, though?  I assume there're probably extension points where I could create the behavior I want using custom targets or something but I do really like how Glide handles all the view/adapter/recycling stuff behind the curtains for me.</p>
<p dir="auto">Any suggestions for how to accomplish this with existing apis or if this is a valid enhancement request?</p>
<p dir="auto">Thanks much!</p>
<p dir="auto">Details:</p>
<p dir="auto"><strong>RecyclerView.Adapter</strong></p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@Override
public void onBindViewHolder(ViewHolder holder, int position) {
    Glide.with(holder.itemView.getContext())
            .load(thumbnails[position])
            .fitCenter()
            .crossFade()
//          .diskCacheStrategy(DiskCacheStrategy.SOURCE)
            .into(holder.image);
}"><pre class="notranslate"><span class="pl-c1">@</span><span class="pl-c1">Override</span>
<span class="pl-k">public</span> <span class="pl-smi">void</span> <span class="pl-s1">onBindViewHolder</span>(<span class="pl-smi">ViewHolder</span> <span class="pl-s1">holder</span>, <span class="pl-smi">int</span> <span class="pl-s1">position</span>) {
    <span class="pl-smi">Glide</span>.<span class="pl-en">with</span>(<span class="pl-s1">holder</span>.<span class="pl-s1">itemView</span>.<span class="pl-en">getContext</span>())
            .<span class="pl-en">load</span>(<span class="pl-s1">thumbnails</span>[<span class="pl-s1">position</span>])
            .<span class="pl-en">fitCenter</span>()
            .<span class="pl-en">crossFade</span>()
<span class="pl-c">//          .diskCacheStrategy(DiskCacheStrategy.SOURCE)</span>
            .<span class="pl-en">into</span>(<span class="pl-s1">holder</span>.<span class="pl-s1">image</span>);
}</pre></div>
<p dir="auto"><strong>View Layout</strong></p>
<div class="highlight highlight-text-xml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;ImageView xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    android:layout_width=&quot;match_parent&quot;
    android:layout_height=&quot;200dp&quot;
    android:scaleType=&quot;centerCrop&quot;
    android:background=&quot;#444444&quot;
    android:layout_marginBottom=&quot;10dp&quot; /&gt;
"><pre class="notranslate">&lt;?<span class="pl-ent">xml</span><span class="pl-e"> version</span>=<span class="pl-s"><span class="pl-pds">"</span>1.0<span class="pl-pds">"</span></span><span class="pl-e"> encoding</span>=<span class="pl-s"><span class="pl-pds">"</span>utf-8<span class="pl-pds">"</span></span>?&gt;
&lt;<span class="pl-ent">ImageView</span> <span class="pl-e">xmlns</span><span class="pl-e">:</span><span class="pl-e">android</span>=<span class="pl-s"><span class="pl-pds">"</span>http://schemas.android.com/apk/res/android<span class="pl-pds">"</span></span>
    <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_width</span>=<span class="pl-s"><span class="pl-pds">"</span>match_parent<span class="pl-pds">"</span></span>
    <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_height</span>=<span class="pl-s"><span class="pl-pds">"</span>200dp<span class="pl-pds">"</span></span>
    <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">scaleType</span>=<span class="pl-s"><span class="pl-pds">"</span>centerCrop<span class="pl-pds">"</span></span>
    <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">background</span>=<span class="pl-s"><span class="pl-pds">"</span>#444444<span class="pl-pds">"</span></span>
    <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">layout_marginBottom</span>=<span class="pl-s"><span class="pl-pds">"</span>10dp<span class="pl-pds">"</span></span> /&gt;
</pre></div>