From 4efa8c4ff5a1e8df74c9a1e0f59202c6036e66c5 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Mon, 18 Jan 2016 22:31:08 -0500 Subject: [PATCH] Remove remaining xlints from plugins --- plugins/discovery-gce/build.gradle | 2 - .../discovery/gce/GceDiscoveryPlugin.java | 2 + plugins/mapper-attachments/build.gradle | 2 - .../mapper/attachments/AttachmentMapper.java | 44 +++++++++---------- 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/plugins/discovery-gce/build.gradle b/plugins/discovery-gce/build.gradle index 6f4459ef753..b888b817679 100644 --- a/plugins/discovery-gce/build.gradle +++ b/plugins/discovery-gce/build.gradle @@ -25,8 +25,6 @@ dependencyLicenses { mapping from: /google-.*/, to: 'google' } -compileJava.options.compilerArgs << '-Xlint:-rawtypes,-unchecked' - test { // this is needed for insecure plugins, remove if possible! systemProperty 'tests.artifact', project.name diff --git a/plugins/discovery-gce/src/main/java/org/elasticsearch/plugin/discovery/gce/GceDiscoveryPlugin.java b/plugins/discovery-gce/src/main/java/org/elasticsearch/plugin/discovery/gce/GceDiscoveryPlugin.java index 5bb5e27ce64..496a1df8a9b 100644 --- a/plugins/discovery-gce/src/main/java/org/elasticsearch/plugin/discovery/gce/GceDiscoveryPlugin.java +++ b/plugins/discovery-gce/src/main/java/org/elasticsearch/plugin/discovery/gce/GceDiscoveryPlugin.java @@ -21,6 +21,7 @@ package org.elasticsearch.plugin.discovery.gce; import com.google.api.client.http.HttpHeaders; import com.google.api.client.util.ClassInfo; + import org.elasticsearch.SpecialPermission; import org.elasticsearch.cloud.gce.GceComputeService; import org.elasticsearch.cloud.gce.GceModule; @@ -91,6 +92,7 @@ public class GceDiscoveryPlugin extends Plugin { } @Override + @SuppressWarnings("rawtypes") // Supertype uses raw type public Collection> nodeServices() { Collection> services = new ArrayList<>(); if (isDiscoveryAlive(settings, logger)) { diff --git a/plugins/mapper-attachments/build.gradle b/plugins/mapper-attachments/build.gradle index 70741c2094d..340832af6f8 100644 --- a/plugins/mapper-attachments/build.gradle +++ b/plugins/mapper-attachments/build.gradle @@ -61,8 +61,6 @@ dependencies { compile 'org.apache.commons:commons-compress:1.10' } -compileJava.options.compilerArgs << '-Xlint:-cast,-rawtypes' - forbiddenPatterns { exclude '**/*.docx' exclude '**/*.pdf' diff --git a/plugins/mapper-attachments/src/main/java/org/elasticsearch/mapper/attachments/AttachmentMapper.java b/plugins/mapper-attachments/src/main/java/org/elasticsearch/mapper/attachments/AttachmentMapper.java index 7c54e6f17ce..e7252eb0e78 100644 --- a/plugins/mapper-attachments/src/main/java/org/elasticsearch/mapper/attachments/AttachmentMapper.java +++ b/plugins/mapper-attachments/src/main/java/org/elasticsearch/mapper/attachments/AttachmentMapper.java @@ -124,23 +124,23 @@ public class AttachmentMapper extends FieldMapper { private Boolean langDetect = null; - private Mapper.Builder contentBuilder; + private Mapper.Builder contentBuilder; - private Mapper.Builder titleBuilder = stringField(FieldNames.TITLE); + private Mapper.Builder titleBuilder = stringField(FieldNames.TITLE); - private Mapper.Builder nameBuilder = stringField(FieldNames.NAME); + private Mapper.Builder nameBuilder = stringField(FieldNames.NAME); - private Mapper.Builder authorBuilder = stringField(FieldNames.AUTHOR); + private Mapper.Builder authorBuilder = stringField(FieldNames.AUTHOR); - private Mapper.Builder keywordsBuilder = stringField(FieldNames.KEYWORDS); + private Mapper.Builder keywordsBuilder = stringField(FieldNames.KEYWORDS); - private Mapper.Builder dateBuilder = dateField(FieldNames.DATE); + private Mapper.Builder dateBuilder = dateField(FieldNames.DATE); - private Mapper.Builder contentTypeBuilder = stringField(FieldNames.CONTENT_TYPE); + private Mapper.Builder contentTypeBuilder = stringField(FieldNames.CONTENT_TYPE); - private Mapper.Builder contentLengthBuilder = integerField(FieldNames.CONTENT_LENGTH); + private Mapper.Builder contentLengthBuilder = integerField(FieldNames.CONTENT_LENGTH); - private Mapper.Builder languageBuilder = stringField(FieldNames.LANGUAGE); + private Mapper.Builder languageBuilder = stringField(FieldNames.LANGUAGE); public Builder(String name) { super(name, new AttachmentFieldType(), new AttachmentFieldType()); @@ -148,47 +148,47 @@ public class AttachmentMapper extends FieldMapper { this.contentBuilder = stringField(FieldNames.CONTENT); } - public Builder content(Mapper.Builder content) { + public Builder content(Mapper.Builder content) { this.contentBuilder = content; return this; } - public Builder date(Mapper.Builder date) { + public Builder date(Mapper.Builder date) { this.dateBuilder = date; return this; } - public Builder author(Mapper.Builder author) { + public Builder author(Mapper.Builder author) { this.authorBuilder = author; return this; } - public Builder title(Mapper.Builder title) { + public Builder title(Mapper.Builder title) { this.titleBuilder = title; return this; } - public Builder name(Mapper.Builder name) { + public Builder name(Mapper.Builder name) { this.nameBuilder = name; return this; } - public Builder keywords(Mapper.Builder keywords) { + public Builder keywords(Mapper.Builder keywords) { this.keywordsBuilder = keywords; return this; } - public Builder contentType(Mapper.Builder contentType) { + public Builder contentType(Mapper.Builder contentType) { this.contentTypeBuilder = contentType; return this; } - public Builder contentLength(Mapper.Builder contentType) { + public Builder contentLength(Mapper.Builder contentType) { this.contentLengthBuilder = contentType; return this; } - public Builder language(Mapper.Builder language) { + public Builder language(Mapper.Builder language) { this.languageBuilder = language; return this; } @@ -202,7 +202,7 @@ public class AttachmentMapper extends FieldMapper { if (contentBuilder instanceof FieldMapper.Builder == false) { throw new IllegalStateException("content field for attachment must be a field mapper"); } - ((FieldMapper.Builder)contentBuilder).indexName(name); + ((FieldMapper.Builder)contentBuilder).indexName(name); contentBuilder.name = name + "." + FieldNames.CONTENT; contentMapper = (FieldMapper) contentBuilder.build(context); context.path().add(name); @@ -299,9 +299,9 @@ public class AttachmentMapper extends FieldMapper { return mapperBuilder; } - @SuppressWarnings({"unchecked"}) @Override - public Mapper.Builder parse(String name, Map node, ParserContext parserContext) throws MapperParsingException { + @SuppressWarnings("unchecked") // Safe because we know how our maps are shaped + public Mapper.Builder parse(String name, Map node, ParserContext parserContext) throws MapperParsingException { AttachmentMapper.Builder builder = new AttachmentMapper.Builder(name); for (Iterator> iterator = node.entrySet().iterator(); iterator.hasNext();) { @@ -316,7 +316,7 @@ public class AttachmentMapper extends FieldMapper { Map propNode = (Map) entry1.getValue(); Mapper.Builder mapperBuilder = findMapperBuilder(propNode, propName, parserContext); - if (parseMultiField((FieldMapper.Builder) mapperBuilder, fieldName, parserContext, propName, propNode)) { + if (parseMultiField((FieldMapper.Builder) mapperBuilder, fieldName, parserContext, propName, propNode)) { fieldsIterator.remove(); } else if (propName.equals(name) && parserContext.indexVersionCreated().before(Version.V_2_0_0_beta1)) { builder.content(mapperBuilder);