typetools / typetools/checker-framework

TaintedChecker false positive with Vector<Object> and .copyInto

Open
#2,422 2 comments 0 reactions 1 assignee View on GitHub

@wmdietl is already working on this.

Since May 16, 2019.

Dominant language
Java
Stars
1.1k
Forks
440
Avg merge
1d 12h
Merged PRs (30d)
134

Description

Using TaintingChecker (i.e. 2.8.0) on code below reports a false positive for the copyInto call.

import java.util.Vector;

public class SHUTest1 {

	public static void main(String[] args) {
		Vector<Object> vector = new Vector<Object>(0);
		SHUTest1 objectListData[] = new SHUTest1[vector.size()];
		vector.copyInto(objectListData);
	}
}

[jsr308.javac] /home/huehner/ob/branches/pi_checker_pg/src/SHUTest1.java:8: error: [vector.copyinto.type.incompatible] incompatible component type in Vector.copyinto.
[jsr308.javac] vector.copyInto(objectListData);
[jsr308.javac] ^
[jsr308.javac] found : @Tainted Object
[jsr308.javac] required: @Tainted SHUTest1

Note that his only happens when the Vector is typed as 'Vector' intead of type matching the argument of copyInto.

While using here does not make any sense can be found in the wild of big / old-codebase.

Note: This could be related / duplicate of either #104 or #660 based on their descriptions.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.