{"action":"opened","issue":{"url":"https://api.github.com/repos/rharter/auto-value-gson/issues/94","repository_url":"https://api.github.com/repos/rharter/auto-value-gson","labels_url":"https://api.github.com/repos/rharter/auto-value-gson/issues/94/labels{/name}","comments_url":"https://api.github.com/repos/rharter/auto-value-gson/issues/94/comments","events_url":"https://api.github.com/repos/rharter/auto-value-gson/issues/94/events","html_url":"https://github.com/rharter/auto-value-gson/issues/94","id":193468597,"number":94,"title":"AdapterFactoryProcessor crashes if there's a typeAdapter() method with no parameters","user":{"login":"hzsweers","id":1361086,"avatar_url":"https://avatars.githubusercontent.com/u/1361086?v=3","gravatar_id":"","url":"https://api.github.com/users/hzsweers","html_url":"https://github.com/hzsweers","followers_url":"https://api.github.com/users/hzsweers/followers","following_url":"https://api.github.com/users/hzsweers/following{/other_user}","gists_url":"https://api.github.com/users/hzsweers/gists{/gist_id}","starred_url":"https://api.github.com/users/hzsweers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hzsweers/subscriptions","organizations_url":"https://api.github.com/users/hzsweers/orgs","repos_url":"https://api.github.com/users/hzsweers/repos","events_url":"https://api.github.com/users/hzsweers/events{/privacy}","received_events_url":"https://api.github.com/users/hzsweers/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-05T11:06:19Z","updated_at":"2016-12-05T11:06:19Z","closed_at":null,"body":"I can get around it by using another name, but seems it should handle this more gracefully.\r\n\r\nAlternatively, you could support it by changing the implementation to this:\r\n\r\n```java\r\nif (params == null || params.size() == 0) {\r\n    create.addStatement(\"return (TypeAdapter<$T>) $T.\" + typeAdapterMethod.getSimpleName() + \"()\", t,\r\n            elementType);\r\n} else if (params.size() == 1) {\r\n    create.addStatement(\"return (TypeAdapter<$T>) $T.\" + typeAdapterMethod.getSimpleName() + \"($N)\", t,\r\n            elementType, gson);\r\n} else {\r\n    create.addStatement(\r\n            \"return (TypeAdapter<$T>) $T.\" + typeAdapterMethod.getSimpleName() + \"($N, ($T) $N)\", t,\r\n            elementType, gson, params.get(1), type);\r\n}\r\n```\r\n\r\nThat would actually allow it to pick up all methods that return a parameter-less adapter (i.e. if someone has a custom adapter that's not generated by auto-value-gson), which may or may not be something you'd be interested in supporting. \r\n\r\nI can PR a fix in the form of disabling the processor or adding a check to skip it, or alternatively PR-ing the example change above to support it. Just let me know!\r\n\r\n```\r\nCaused by: java.lang.IndexOutOfBoundsException: Index: 1, Size: 0\r\n        at com.sun.tools.javac.util.List.get(List.java:476)\r\n        at com.ryanharter.auto.value.gson.AutoValueGsonAdapterFactoryProcessor.createTypeAdapterFactory(AutoValueGsonAdapterFactoryProcessor.java:147)\r\n        at com.ryanharter.auto.value.gson.AutoValueGsonAdapterFactoryProcessor.process(AutoValueGsonAdapterFactoryProcessor.java:94)\r\n        at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)\r\n        at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:705)\r\n        at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)\r\n        at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035)\r\n        at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176)\r\n        at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)\r\n        at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856)\r\n        at com.sun.tools.javac.main.Main.compile(Main.java:523)\r\n\r\n```"}}
{"actor":{"display_login":"hzsweers"}}