Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

added support for wrapping literals in Option (so far its not working

because compiler returns strange annotations)
  • Loading branch information...
commit 4285a15254e88b7cf160b0a3fc60e200e39f74e8 1 parent e9de447
@kaptoxic kaptoxic authored
10 org.scala-ide.sdt.core/src/scala/tools/eclipse/quickfix/TypeMismatchQuickFixProcessor.scala
@@ -7,7 +7,7 @@ import java.util.regex.Pattern
* @author Ivan Kuraj
* This object is used for applying code transformations based on the found and required type
* extract from the annotation message (such as quick fix message) and the expression in the source code.
- * The object arguments are: found type string, required type string and annotation string, respective and
+ * The object arguments are: found type string, required type string and annotation string, respectively and
* the result is a list of strings which should replace the annotation string
object TypeMismatchQuickFixProcessor extends
@@ -31,6 +31,13 @@ object TypeMismatchQuickFixProcessor extends
List("Option(%s)", "Some(%s)"),
Pattern.compile("(.*)"), Pattern.compile("Option\\[(.*)\\]"), Pattern.compile("^(.*)$")
+ // TODO: compiler does not return annotations properly, uncomment this and tests when it is fixed
+ // "type mismatch: found BasicType(T); required Option[T]" -> suggest to wrap the result in Some()
+// ,
+// FoundToRequiredTypeCase(
+// List("Option(%s)", "Some(%s)"),
+// Pattern.compile("(?:java\\.lang\\.)([a-zA-Z&&[^\\(\\)]]+)\\(.*\\)"), Pattern.compile("Option\\[(.*)\\]"), Pattern.compile("^(.*)$")
+// )
@@ -73,6 +80,7 @@ abstract class SimpleFormatQuickFixCase(formatStrings: List[String]) extends Typ
* capturing all groups according to the found and required patterns and compares them for match -
* if all match, the replacement is proceeded by extracting inject strings from the annotation pattern
* and applying them to SimpleFormatQuickFixCase
+ *
* found and required patterns should extract the same number of groups
* annotation string should extract required number of groups to feed the given format string
Please sign in to comment.
Something went wrong with that request. Please try again.